Shortcuts

torch.utils.ffi

torch.utils.ffi.create_extension(name, headers, sources, verbose=True, with_cuda=False, package=False, relative_to='.', **kwargs)[source]

Creates and configures a cffi.FFI object, that builds PyTorch extension.

Parameters:
  • name (str) – package name. Can be a nested module e.g. .ext.my_lib.
  • headers (str or List[str]) – list of headers, that contain only exported functions
  • sources (List[str]) – list of sources to compile.
  • verbose (bool, optional) – if set to False, no output will be printed (default: True).
  • with_cuda (bool, optional) – set to True to compile with CUDA headers (default: False)
  • package (bool, optional) – set to True to build in package mode (for modules meant to be installed as pip packages) (default: False).
  • relative_to (str, optional) – path of the build file. Required when package is True. It’s best to use __file__ for this argument.
  • kwargs – additional arguments that are passed to ffi to declare the extension. See Extension API reference for details.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources