To register your own kernel for an operator, do in one (!) cpp file: C10_REGISTER_KERNEL(OperatorHandle) .kernel<decltype(&kernel_func), &kernel_func>() .dispatchKey(dispatch_key);. More...
Namespaces | |
enforce_detail | |
Rich logging messages. | |
Data Structures | |
struct | _CopyBytesFunctionRegisterer |
struct | _fake_type |
class | AliasInfo |
class AliasInfo More... | |
struct | AlignedCharArray |
Helper for building an aligned character array type. More... | |
struct | AlignedCharArrayUnion |
This union template exposes a suitably aligned and sized character array member which can hold elements of any of up to ten types. More... | |
struct | Allocator |
struct | AllocatorRegisterer |
struct | Argument |
class | ArrayRef |
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. More... | |
struct | AutogradMetaInterface |
struct | AutogradZeroTensorType |
class | bad_optional_access |
struct | BoolType |
class | C10FlagParser |
class | C10Tensor |
This is a minimal Tensor class for use in c10 code. More... | |
struct | ClassType |
struct | CompleteTensorType |
struct | ComplexHalf |
struct | constexpr_optional_base |
union | constexpr_storage_t |
struct | Converter |
struct | Converter< To, std::complex< FromV >, typename std::enable_if< c10::guts::negation< is_complex_t< To > >::value >::type > |
class | DataPtr |
struct | DefaultCPUAllocator |
struct | DefaultTensorOptions |
Like TensorOptions, but all fields are guaranteed to be filled. More... | |
struct | Device |
Represents a a compute device on which a tensor is located. More... | |
class | DeviceGuard |
RAII guard that sets a certain default device in its constructor, and changes it back to the device that was originally active upon destruction. More... | |
struct | DeviceObjType |
struct | DictType |
struct | DimensionedTensorType |
class | Dispatcher |
Top-level dispatch interface for dispatching via the dynamic dispatcher. More... | |
class | DispatchTable |
Per-operator dispatch table. More... | |
struct | DispatchTableEntry |
The dispatch table stores a pointer to a kernel function and a pointer to a function initializing a cache for the kernel. More... | |
class | Error |
The primary ATen error class. More... | |
struct | FloatType |
struct | FunctionSchema |
struct | FutureType |
struct | GeneratorType |
struct | Half |
class | IdWrapper |
This template simplifies generation of simple classes that wrap an id in a typesafe way. More... | |
struct | in_place_t |
class | IndexError |
struct | InefficientStdFunctionContext |
struct | InternedStrings |
class | intrusive_ptr |
class | intrusive_ptr_target |
intrusive_ptr<T> is an alternative to shared_ptr<T> that has better performance because it does the refcounting intrusively (i.e. More... | |
struct | IntType |
struct | is_complex_t |
struct | is_complex_t< ComplexHalf > |
struct | is_complex_t< std::complex< T > > |
struct | ivalue |
struct | IValue |
class | KernelCache |
A kernel can keep around a cache to have better performance when it's called multiple times. More... | |
class | KernelRegistrar |
Class which, on construction, registers an operator in the dispatch table. More... | |
class | KernelRegistrationBuilder |
Helper class for building a KernelRegistrar. More... | |
class | LeftRight |
struct | ListType |
class | LoggerVoidify |
struct | MatchTypeReturn |
class | MemoryAllocationReporter |
class | MessageLogger |
struct | NoneType |
struct | nullopt_t |
struct | NumberType |
class | OperatorHandle |
This is a handle to an operator schema registered with the dispatcher. More... | |
class | OpKernel |
This class represents an operator kernel, i.e. More... | |
class | OpRegistrationListener |
Implement this interface and register your instance with the dispatcher to get notified when operators are registered or deregistered with the dispatcher. More... | |
class | optional |
class | optional< T & > |
class | optional< T && > |
struct | optional_base |
class | OptionalDeviceGuard |
A OptionalDeviceGuard is an RAII class that sets a device to some value on initialization, and resets the device to its original value on destruction. More... | |
struct | OptionalStreamGuard |
An OptionalStreamGuard is an RAII class that sets a device to some value on initialization, and resets the device to its original value on destruction. More... | |
struct | OptionalType |
struct | PlacementDeleteContext |
class | Registerer |
class | Registry |
A template class that allows one to register classes by keys. More... | |
class | Scalar |
Scalar represents a 0-dimensional tensor which contains a single element. More... | |
struct | scalar_value_type |
struct | scalar_value_type< ComplexHalf > |
struct | scalar_value_type< std::complex< T > > |
struct | SingleElementType |
class | SmallVector |
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small. More... | |
class | SmallVectorBase |
This is all the non-templated stuff common to all SmallVectors. More... | |
class | SmallVectorImpl |
This class consists of common code factored out of the SmallVector class to reduce code duplication based on the SmallVector 'N' template parameter. More... | |
struct | SmallVectorStorage |
Storage for the SmallVector elements which aren't contained in SmallVectorTemplateCommon. More... | |
struct | SmallVectorStorage< T, 0 > |
struct | SmallVectorStorage< T, 1 > |
class | SmallVectorTemplateBase |
SmallVectorTemplateBase<isPodLike = false> - This is where we put method implementations that are designed to work with non-POD-like T's. More... | |
class | SmallVectorTemplateBase< T, true > |
SmallVectorTemplateBase<isPodLike = true> - This is where we put method implementations that are designed to work with POD-like T's. More... | |
class | SmallVectorTemplateCommon |
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD. More... | |
struct | SourceLocation |
Represents a location in source code (for debugging). More... | |
struct | Storage |
union | storage_t |
struct | StorageImpl |
class | Stream |
A stream is a software mechanism used to synchronize launched kernels without requiring explicit synchronizations between kernels. More... | |
struct | StreamGuard |
A StreamGuard is an RAII class that changes the current device to the device corresponding to some stream, and changes the default stream on that device to be this stream. More... | |
struct | StringType |
struct | Symbol |
class | TaskThreadPool |
class | TaskThreadPoolBase |
struct | TempFile |
struct | TensorImpl |
The low-level representation of a tensor, which contains a pointer to a storage (which contains the actual data) and metadata (e.g., sizes and strides) describing this particular view of the data as a tensor. More... | |
struct | TensorOptions |
struct | TensorType |
class | TensorTypeId |
Dynamic type ID of a Tensor argument. More... | |
class | TensorTypeIdCreator |
class | TensorTypeIdRegistrar |
class | TensorTypeIdRegistry |
class | TensorTypeIds |
class | ThreadPool |
struct | trivial_init_t |
struct | TupleType |
struct | Type |
struct | UndefinedTensorImpl |
struct | VarType |
class | Warning |
class | weak_intrusive_ptr |
Typedefs | |
using | KernelCacheCreatorFunction) = std::unique_ptr< c10::KernelCache >( |
The type of a user-supplied function to initialize the kernel cache. More... | |
using | Stack = torch::jit::Stack |
using | KernelFunction = void(Stack *, KernelCache *cache) |
This is the basic ABI for any kernel call. More... | |
using | unique_t = uint32_t |
using | TypePtr = std::shared_ptr< Type > |
using | OptionalTypePtr = std::shared_ptr< OptionalType > |
using | TensorTypePtr = std::shared_ptr< TensorType > |
using | AutogradZeroTensorTypePtr = std::shared_ptr< AutogradZeroTensorType > |
using | DimensionedTensorTypePtr = std::shared_ptr< DimensionedTensorType > |
using | CompleteTensorTypePtr = std::shared_ptr< CompleteTensorType > |
using | ListTypePtr = std::shared_ptr< ListType > |
using | DictTypePtr = std::shared_ptr< DictType > |
using | FutureTypePtr = std::shared_ptr< FutureType > |
using | TupleTypePtr = std::shared_ptr< TupleType > |
using | OptNameList = c10::optional< std::vector< std::string >> |
using | NumberTypePtr = std::shared_ptr< NumberType > |
using | FloatTypePtr = std::shared_ptr< FloatType > |
using | IntTypePtr = std::shared_ptr< IntType > |
using | BoolTypePtr = std::shared_ptr< BoolType > |
using | StringTypePtr = std::shared_ptr< StringType > |
using | NoneTypePtr = std::shared_ptr< NoneType > |
using | GeneratorTypePtr = std::shared_ptr< GeneratorType > |
using | DeviceObjTypePtr = std::shared_ptr< DeviceObjType > |
using | VarTypePtr = std::shared_ptr< VarType > |
using | TypeEnv = std::unordered_map< std::string, TypePtr > |
using | ClassTypePtr = std::shared_ptr< ClassType > |
using | CopyBytesFunction = void(*)(size_t nbytes, const void *src, Device src_device, void *dst, Device dst_device) |
using | MemoryDeleter = void(*)(void *) |
using | DeviceIndex = int16_t |
An index representing a specific device; e.g., the 1 in GPU 1. More... | |
using | StreamId = int32_t |
An index representing a specific stream. More... | |
using | PlacementDtor = void(*)(void *, size_t) |
using | IntArrayRef = ArrayRef< int64_t > |
using | C10_DEPRECATED_USING = ArrayRef< int64_t > |
using | weak_intrusive_ptr_target = intrusive_ptr_target |
using | EnforceNotMet = ::c10::Error |
template<class T > | |
using | OptionalBase = typename std::conditional< std::is_trivially_destructible< T >::value, constexpr_optional_base< typename std::remove_const< T >::type >, optional_base< typename std::remove_const< T >::type >>::type |
using | DeleterFnPtr = void(*)(void *) |
Enumerations | |
enum | _keys : unique_t { DEFINE_KEY, num_symbols } |
enum | TypeKind { DEFINE_TYPE } |
enum | Backend { CPU, CUDA, HIP, SparseCPU, SparseCUDA, SparseHIP, MSNPU, XLA, Undefined, NumOptions } |
This legacy enum class defines the set of backends supported by old school, code generated Type-based ATen. More... | |
enum | DeviceType : int16_t { CPU = 0, CUDA = 1, MKLDNN = 2, OPENGL = 3, OPENCL = 4, IDEEP = 5, HIP = 6, FPGA = 7, MSNPU = 8, XLA = 9, COMPILE_TIME_MAX_DEVICE_TYPES = 10, ONLY_FOR_TEST = 20901 } |
enum | Layout : int8_t { Strided, Sparse } |
enum | ScalarType : int8_t { DEFINE_ENUM, Undefined, NumOptions } |
enum | RegistryPriority { REGISTRY_FALLBACK = 1, REGISTRY_DEFAULT = 2, REGISTRY_PREFERRED = 3 } |
Functions | |
std::ostream & | operator<< (std::ostream &out, const AliasInfo &aliasInfo) |
std::ostream & | operator<< (std::ostream &out, Backend b) |
std::ostream & | operator<< (std::ostream &out, const Argument &arg) |
std::ostream & | operator<< (std::ostream &out, const FunctionSchema &schema) |
template<typename F , typename T > | |
auto | fmap (const T &inputs, const F &fn) -> std::vector< decltype(fn(*inputs.begin()))> |
template<typename F , typename T > | |
auto | fmap (T &inputs, const F &fn) -> std::vector< decltype(fn(*inputs.begin()))> |
template<typename R , typename T > | |
std::vector< R > | fmap (const T &inputs) |
template<typename F , typename T > | |
std::vector< T > | filter (at::ArrayRef< T > inputs, const F &fn) |
template<typename F , typename T > | |
std::vector< T > | filter (const std::vector< T > &inputs, const F &fn) |
const std::string & | domain_prefix () |
std::ostream & | operator<< (std::ostream &out, const IValue &v) |
DEFINE_TO (c10::intrusive_ptr< caffe2::Blob >, toBlob) | |
template<typename Elem > | |
std::vector< Elem > | generic_to (const IValue *ivalue, _fake_type< std::vector< Elem >>) |
template<typename K , typename V > | |
std::unordered_map< K, V > | generic_to (const IValue *ivalue, _fake_type< std::unordered_map< K, V >>) |
CAFFE2_API const char * | typeKindToString (TypeKind kind) |
bool | operator!= (const Type &lhs, const Type &rhs) |
CAFFE2_API std::ostream & | operator<< (std::ostream &out, const Type &t) |
TypePtr | unshapedType (const TypePtr &type) |
CAFFE2_API c10::optional< TypePtr > | unifyTypes (const TypePtr &t1, const TypePtr &t2) |
template<class T > | |
TypePtr | getTypePtr () |
CAFFE2_API TypePtr | incompleteInferTypeFrom (const IValue &value) |
CAFFE2_API TypePtr | attemptToRecoverType (const IValue &input_ivalue) |
CAFFE2_API bool | isSubvalueOf (const IValue &input_ivalue, TypePtr type) |
CAFFE2_API MatchTypeReturn | matchTypeVariables (TypePtr formal, TypePtr actual, TypeEnv &type_env) |
CAFFE2_API TypePtr | evalTypeVariables (TypePtr type, TypeEnv &type_env) |
c10::optional< TypePtr > | tryEitherIsTheSuperType (const TypePtr &t1, const TypePtr &t2) |
CAFFE2_API TypePtr | evalTypeVariables (TypePtr type, std::unordered_map< std::string, TypePtr > &type_env) |
at::Tensor | scalar_to_tensor (Scalar s) |
void | SetAllocator (DeviceType t, Allocator *alloc) |
Set the allocator for DeviceType t . More... | |
at::Allocator * | GetAllocator (const at::DeviceType &t) |
bool | operator== (const DataPtr &dp, std::nullptr_t) noexcept |
bool | operator== (std::nullptr_t, const DataPtr &dp) noexcept |
bool | operator!= (const DataPtr &dp, std::nullptr_t) noexcept |
bool | operator!= (std::nullptr_t, const DataPtr &dp) noexcept |
void | CopyBytes (size_t nbytes, const void *src, Device src_device, void *dst, Device dst_device, bool async) |
void | memset_junk (void *data, size_t num) |
void * | alloc_cpu (size_t nbytes) |
void | free_cpu (void *data) |
void | NoDelete (void *) |
at::Allocator * | GetCPUAllocator () |
void | SetCPUAllocator (at::Allocator *alloc) |
at::Allocator * | GetDefaultCPUAllocator () |
REGISTER_ALLOCATOR (DeviceType::CPU,&g_cpu_alloc) | |
void | set_default_dtype (caffe2::TypeMeta dtype) |
const caffe2::TypeMeta & | get_default_dtype () |
const DefaultTensorOptions & | getDefaultTensorOptions () |
std::ostream & | operator<< (std::ostream &stream, const Device &device) |
std::string | DeviceTypeName (DeviceType d, bool lower_case) |
bool | isValidDeviceType (DeviceType d) |
std::ostream & | operator<< (std::ostream &stream, DeviceType type) |
Layout | layout_from_backend (Backend backend) |
std::ostream & | operator<< (std::ostream &stream, at::Layout layout) |
std::ostream & | operator<< (std::ostream &stream, at::ScalarType scalar_type) |
std::ostream & | operator<< (std::ostream &stream, const Stream &s) |
std::vector< int64_t > | ToVectorint64_t (ArrayRef< int > src) |
A utility function to convert vector<int> to vector<int64_t>. | |
int64_t | size_from_dim_ (int k, IntArrayRef dims) |
Return product of all dimensions starting from k. | |
int64_t | size_to_dim_ (int k, IntArrayRef dims) |
int64_t | size_between_dim_ (int k, int l, IntArrayRef dims) |
int | canonical_axis_index_ (int axis_index, int ndims) |
std::ostream & | operator<< (std::ostream &stream, const TensorOptions &options) |
TensorOptions (T &&device) | |
A class to encapsulate construction axes of an Tensor. More... | |
template<typename... Args, * typename = std::enable_if_t<std::is_constructible<Device, Args&&...>::value>> | |
*** | TensorOptions (Args &&...args)* |
TensorOptions | dtype (caffe2::TypeMeta dtype) |
Convenience function that returns a TensorOptions object with the dtype set to the given one. More... | |
TensorOptions | dtype (ScalarType dtype) |
TensorOptions | layout (Layout layout) |
Convenience function that returns a TensorOptions object with the layout set to the given one. More... | |
TensorOptions | device (Device device) |
Convenience function that returns a TensorOptions object with the device set to the given one. More... | |
TensorOptions | device_index (int16_t device_index) |
Convenience function that returns a TensorOptions object with the device set to CUDA and the device_index set to the given one. More... | |
TensorOptions | requires_grad (bool requires_grad=true) |
Convenience function that returns a TensorOptions object with the requires_grad set to the given one. More... | |
template<typename T > | |
TensorOptions | dtype () |
TensorTypeId | computeTensorTypeId (TensorOptions options) |
DeviceType | computeDeviceType (TensorTypeId tid) |
std::ostream & | operator<< (std::ostream &str, c10::TensorTypeId rhs) |
std::string | toString (TensorTypeId id) |
C10_DEFINE_TENSOR_TYPE (UndefinedTensorId) | |
C10_DEFINE_TENSOR_TYPE (CPUTensorId) | |
C10_DEFINE_TENSOR_TYPE (CUDATensorId) | |
C10_DEFINE_TENSOR_TYPE (SparseCPUTensorId) | |
C10_DEFINE_TENSOR_TYPE (SparseCUDATensorId) | |
C10_DEFINE_TENSOR_TYPE (MKLDNNTensorId) | |
C10_DEFINE_TENSOR_TYPE (OpenGLTensorId) | |
C10_DEFINE_TENSOR_TYPE (OpenCLTensorId) | |
C10_DEFINE_TENSOR_TYPE (IDEEPTensorId) | |
C10_DEFINE_TENSOR_TYPE (HIPTensorId) | |
C10_DEFINE_TENSOR_TYPE (SparseHIPTensorId) | |
C10_DEFINE_TENSOR_TYPE (MSNPUTensorId) | |
C10_DEFINE_TENSOR_TYPE (XLATensorId) | |
C10_DECLARE_TENSOR_TYPE (UndefinedTensorId) | |
C10_DECLARE_TENSOR_TYPE (CPUTensorId) | |
C10_DECLARE_TENSOR_TYPE (CUDATensorId) | |
C10_DECLARE_TENSOR_TYPE (SparseCPUTensorId) | |
C10_DECLARE_TENSOR_TYPE (SparseCUDATensorId) | |
C10_DECLARE_TENSOR_TYPE (MKLDNNTensorId) | |
C10_DECLARE_TENSOR_TYPE (OpenGLTensorId) | |
C10_DECLARE_TENSOR_TYPE (OpenCLTensorId) | |
C10_DECLARE_TENSOR_TYPE (IDEEPTensorId) | |
C10_DECLARE_TENSOR_TYPE (HIPTensorId) | |
C10_DECLARE_TENSOR_TYPE (SparseHIPTensorId) | |
C10_DECLARE_TENSOR_TYPE (MSNPUTensorId) | |
C10_DECLARE_TENSOR_TYPE (XLATensorId) | |
void | setNumThreads (size_t v) |
TaskThreadPoolBase & | global_work_queue () |
C10_DEFINE_SHARED_REGISTRY (ThreadPoolRegistry, TaskThreadPoolBase, int, int, bool) | |
C10_REGISTER_CREATOR (ThreadPoolRegistry, C10, createC10ThreadPool) | |
C10_DECLARE_SHARED_REGISTRY (ThreadPoolRegistry, TaskThreadPoolBase, int, int, bool) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, ArrayRef< T > list) |
template<typename T > | |
bool | operator== (c10::ArrayRef< T > a1, c10::ArrayRef< T > a2) |
template<typename T > | |
bool | operator!= (c10::ArrayRef< T > a1, c10::ArrayRef< T > a2) |
template<typename T > | |
bool | operator== (std::vector< T > a1, c10::ArrayRef< T > a2) |
template<typename T > | |
bool | operator!= (std::vector< T > a1, c10::ArrayRef< T > a2) |
template<typename T > | |
bool | operator== (c10::ArrayRef< T > a1, std::vector< T > a2) |
template<typename T > | |
bool | operator!= (c10::ArrayRef< T > a1, std::vector< T > a2) |
std::string | get_backtrace (size_t frames_to_skip, size_t maximum_number_of_frames, bool skip_python_frames) |
std::string | GetExceptionString (const std::exception &e) |
C10_API void | SetUsageMessage (const std::string &str) |
Sets the usage message when a commandline tool is called with "--help". | |
C10_API const char * | UsageMessage () |
Returns the usage message for the commandline tool set by SetUsageMessage. | |
C10_API bool | ParseCommandLineFlags (int *pargc, char ***pargv) |
Parses the commandline flags. More... | |
C10_API bool | CommandLineFlagsHasBeenParsed () |
Checks if the commandline flags has already been passed. | |
C10_DECLARE_REGISTRY (C10FlagsRegistry, C10FlagParser, const std::string &) | |
C10_DEFINE_REGISTRY (C10FlagsRegistry, C10FlagParser, const string &) | |
C10_EXPORT void | SetUsageMessage (const string &str) |
C10_HOST_DEVICE Half | operator+ (const Half &a, const Half &b) |
Arithmetic. | |
C10_HOST_DEVICE Half | operator- (const Half &a, const Half &b) |
C10_HOST_DEVICE Half | operator* (const Half &a, const Half &b) |
C10_HOST_DEVICE Half | operator/ (const Half &a, const Half &b) |
C10_HOST_DEVICE Half | operator- (const Half &a) |
C10_HOST_DEVICE Half & | operator+= (Half &a, const Half &b) |
C10_HOST_DEVICE Half & | operator-= (Half &a, const Half &b) |
C10_HOST_DEVICE Half & | operator*= (Half &a, const Half &b) |
C10_HOST_DEVICE Half & | operator/= (Half &a, const Half &b) |
C10_HOST_DEVICE float | operator+ (Half a, float b) |
Arithmetic with floats. | |
C10_HOST_DEVICE float | operator- (Half a, float b) |
C10_HOST_DEVICE float | operator* (Half a, float b) |
C10_HOST_DEVICE float | operator/ (Half a, float b) |
C10_HOST_DEVICE float | operator+ (float a, Half b) |
C10_HOST_DEVICE float | operator- (float a, Half b) |
C10_HOST_DEVICE float | operator* (float a, Half b) |
C10_HOST_DEVICE float | operator/ (float a, Half b) |
C10_HOST_DEVICE float & | operator+= (float &a, const Half &b) |
C10_HOST_DEVICE float & | operator-= (float &a, const Half &b) |
C10_HOST_DEVICE float & | operator*= (float &a, const Half &b) |
C10_HOST_DEVICE float & | operator/= (float &a, const Half &b) |
C10_HOST_DEVICE double | operator+ (Half a, double b) |
Arithmetic with doubles. | |
C10_HOST_DEVICE double | operator- (Half a, double b) |
C10_HOST_DEVICE double | operator* (Half a, double b) |
C10_HOST_DEVICE double | operator/ (Half a, double b) |
C10_HOST_DEVICE double | operator+ (double a, Half b) |
C10_HOST_DEVICE double | operator- (double a, Half b) |
C10_HOST_DEVICE double | operator* (double a, Half b) |
C10_HOST_DEVICE double | operator/ (double a, Half b) |
C10_HOST_DEVICE Half | operator+ (Half a, int b) |
Arithmetic with ints. | |
C10_HOST_DEVICE Half | operator- (Half a, int b) |
C10_HOST_DEVICE Half | operator* (Half a, int b) |
C10_HOST_DEVICE Half | operator/ (Half a, int b) |
C10_HOST_DEVICE Half | operator+ (int a, Half b) |
C10_HOST_DEVICE Half | operator- (int a, Half b) |
C10_HOST_DEVICE Half | operator* (int a, Half b) |
C10_HOST_DEVICE Half | operator/ (int a, Half b) |
C10_HOST_DEVICE Half | operator+ (Half a, int64_t b) |
C10_HOST_DEVICE Half | operator- (Half a, int64_t b) |
C10_HOST_DEVICE Half | operator* (Half a, int64_t b) |
C10_HOST_DEVICE Half | operator/ (Half a, int64_t b) |
C10_HOST_DEVICE Half | operator+ (int64_t a, Half b) |
C10_HOST_DEVICE Half | operator- (int64_t a, Half b) |
C10_HOST_DEVICE Half | operator* (int64_t a, Half b) |
C10_HOST_DEVICE Half | operator/ (int64_t a, Half b) |
std::ostream & | operator<< (std::ostream &out, const Half &value) |
template<typename To , typename From > | |
To | convert (From from) |
template<typename To , typename From > | |
std::enable_if< std::is_integral< From >::value, bool >::type | overflows (From f) |
template<typename To , typename From > | |
std::enable_if< std::is_floating_point< From >::value, bool >::type | overflows (From f) |
template<typename To , typename From > | |
std::enable_if< is_complex_t< From >::value, bool >::type | overflows (From f) |
template<typename To , typename From > | |
To | checked_convert (From f, const char *name) |
template<class TTarget , class NullType = detail::intrusive_target_default_null_type<TTarget>, class... Args> | |
intrusive_ptr< TTarget, NullType > | make_intrusive (Args &&...args) |
template<class TTarget , class NullType > | |
void | swap (intrusive_ptr< TTarget, NullType > &lhs, intrusive_ptr< TTarget, NullType > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator< (const intrusive_ptr< TTarget1, NullType1 > &lhs, const intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator== (const intrusive_ptr< TTarget1, NullType1 > &lhs, const intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator!= (const intrusive_ptr< TTarget1, NullType1 > &lhs, const intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
template<class TTarget , class NullType > | |
void | swap (weak_intrusive_ptr< TTarget, NullType > &lhs, weak_intrusive_ptr< TTarget, NullType > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator< (const weak_intrusive_ptr< TTarget1, NullType1 > &lhs, const weak_intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator== (const weak_intrusive_ptr< TTarget1, NullType1 > &lhs, const weak_intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 > | |
bool | operator!= (const weak_intrusive_ptr< TTarget1, NullType1 > &lhs, const weak_intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept |
void | SetStackTraceFetcher (std::function< string(void)> fetcher) |
void | ThrowEnforceNotMet (const char *file, const int line, const char *condition, const std::string &msg, const void *caller) |
bool | InitCaffeLogging (int *argc, char **argv) |
void | UpdateLoggingLevelsFromFlags () |
void | ShowLogInfoToStderr () |
A utility to allow one to show log info to stderr after the program starts. More... | |
constexpr bool | IsUsingGoogleLogging () |
template<class T > | |
void | LogMessageFatal (const char *file, int line, const T &message) |
template<typename T > | |
T & | CheckNotNullCommon (const char *file, int line, const char *names, T &t) |
template<typename T > | |
T * | CheckNotNull (const char *file, int line, const char *names, T *t) |
template<typename T > | |
T & | CheckNotNull (const char *file, int line, const char *names, T &t) |
template<class Iter > | |
void | PrintSequence (std::ostream &ss, Iter begin, Iter end) |
bool | IsNUMAEnabled () |
Check whether NUMA is enabled. | |
void | NUMABind (int numa_node_id) |
Bind to a given NUMA node. | |
int | GetNUMANode (const void *ptr) |
Get the NUMA id for a given pointer ptr | |
int | GetNumNUMANodes () |
Get number of NUMA nodes. | |
void | NUMAMove (void *ptr, size_t size, int numa_node_id) |
Move the memory pointed to by ptr of a given size to another NUMA node. | |
int | GetCurrentNUMANode () |
Get the current NUMA node id. | |
template<class T > | |
constexpr T && | constexpr_forward (typename std::remove_reference< T >::type &t) noexcept |
template<class T > | |
constexpr T && | constexpr_forward (typename std::remove_reference< T >::type &&t) noexcept |
template<class T > | |
constexpr std::remove_reference< T >::type && | constexpr_move (T &&t) noexcept |
template<class T > | |
constexpr bool | operator== (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator!= (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator< (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator> (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator<= (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator>= (const optional< T > &x, const optional< T > &y) |
template<class T > | |
constexpr bool | operator== (const optional< T > &x, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator== (nullopt_t, const optional< T > &x) noexcept |
template<class T > | |
constexpr bool | operator!= (const optional< T > &x, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator!= (nullopt_t, const optional< T > &x) noexcept |
template<class T > | |
constexpr bool | operator< (const optional< T > &, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator< (nullopt_t, const optional< T > &x) noexcept |
template<class T > | |
constexpr bool | operator<= (const optional< T > &x, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator<= (nullopt_t, const optional< T > &) noexcept |
template<class T > | |
constexpr bool | operator> (const optional< T > &x, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator> (nullopt_t, const optional< T > &) noexcept |
template<class T > | |
constexpr bool | operator>= (const optional< T > &, nullopt_t) noexcept |
template<class T > | |
constexpr bool | operator>= (nullopt_t, const optional< T > &x) noexcept |
template<class T > | |
constexpr bool | operator== (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator== (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator!= (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator!= (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator< (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator> (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator> (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator< (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator>= (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator<= (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator<= (const optional< T > &x, const T &v) |
template<class T > | |
constexpr bool | operator>= (const T &v, const optional< T > &x) |
template<class T > | |
constexpr bool | operator== (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator== (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator!= (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator!= (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator< (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator> (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator> (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator< (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator>= (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator<= (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator<= (const optional< T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator>= (const T &v, const optional< T & > &x) |
template<class T > | |
constexpr bool | operator== (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator== (const T &v, const optional< const T & > &x) |
template<class T > | |
constexpr bool | operator!= (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator!= (const T &v, const optional< const T & > &x) |
template<class T > | |
constexpr bool | operator< (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator> (const T &v, const optional< const T & > &x) |
template<class T > | |
constexpr bool | operator> (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator< (const T &v, const optional< const T & > &x) |
template<class T > | |
constexpr bool | operator>= (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator<= (const T &v, const optional< const T & > &x) |
template<class T > | |
constexpr bool | operator<= (const optional< const T & > &x, const T &v) |
template<class T > | |
constexpr bool | operator>= (const T &v, const optional< const T & > &x) |
template<class T > | |
void | swap (optional< T > &x, optional< T > &y) noexcept(noexcept(x.swap(y))) |
template<class T > | |
constexpr optional< typename std::decay< T >::type > | make_optional (T &&v) |
template<class X > | |
constexpr optional< X & > | make_optional (std::reference_wrapper< X > v) |
template<typename KeyType > | |
std::string | KeyStrRepr (const KeyType &) |
template<> | |
std::string | KeyStrRepr (const std::string &key) |
template<typename T , unsigned N> | |
size_t | capacity_in_bytes (const SmallVector< T, N > &X) |
template<typename T , unsigned N> | |
std::ostream & | operator<< (std::ostream &out, const SmallVector< T, N > &list) |
std::ostream & | operator<< (std::ostream &out, const SourceLocation &loc) |
size_t | ReplaceAll (std::string &s, const char *from, const char *to) |
template<typename... Args> | |
std::string | str (const Args &...args) |
template<> | |
std::string | str (const std::string &str) |
std::string | str (const char *c_str) |
template<class Container > | |
std::string | Join (const std::string &delimiter, const Container &v) |
c10::optional< TempFile > | try_make_tempfile (std::string name_prefix="torch-file-") |
Attempts to return a temporary file or returns nullopt if an error ocurred. More... | |
TempFile | make_tempfile (std::string name_prefix="torch-file-") |
Like try_make_tempfile , but throws an exception if a temporary file could not be returned. More... | |
void | setThreadName (std::string name) |
std::string | demangle (const char *name) |
Utility to demangle a C++ symbol name. | |
template<typename T > | |
const char * | demangle_type () |
Returns the printable name of the type. | |
C10_REGISTER_CREATOR (ThreadPoolRegistry, CPU, caffe2::GetAsyncNetThreadPool< TaskThreadPool, caffe2::PROTO_CPU >) | |
C10_REGISTER_CREATOR (ThreadPoolRegistry, CUDA, caffe2::GetAsyncNetThreadPool< TaskThreadPool, caffe2::PROTO_CUDA >) | |
C10_REGISTER_CREATOR (ThreadPoolRegistry, HIP, caffe2::GetAsyncNetThreadPool< TaskThreadPool, caffe2::PROTO_HIP >) | |
kernel< decltype(caffe2::batch_gather_op_cpu),&caffe2::batch_gather_op_cpu > ().dispatchKey(CPUTensorId()) | |
kernel< decltype(caffe2::cast_op_cpu),&caffe2::cast_op_cpu > ().dispatchKey(CPUTensorId()) | |
kernel< decltype(caffe2::constant_fill_op_cpu_impl),&caffe2::constant_fill_op_cpu_impl > ().dispatchKey(CPUTensorId()) | |
kernel< decltype(caffe2::uniform_fill_op_cpu_impl),&caffe2::uniform_fill_op_cpu_impl > ().dispatchKey(CPUTensorId()) | |
kernel< decltype(caffe2::sigmoid_cross_entropy_with_logits_op_cpu_impl),&caffe2::sigmoid_cross_entropy_with_logits_op_cpu_impl > ().dispatchKey(CPUTensorId()) | |
kernel< decltype(caffe2::sparse_lengths_sum_op_cpu),&caffe2::sparse_lengths_sum_op_cpu > ().dispatchKey(CPUTensorId()) | |
Variables | |
class CAFFE2_API | OperatorHandle |
C10_API at::Allocator * | allocator_array [at::COMPILE_TIME_MAX_DEVICE_TYPES] |
constexpr DeviceType | kCPU = DeviceType::CPU |
constexpr DeviceType | kCUDA = DeviceType::CUDA |
constexpr DeviceType | kHIP = DeviceType::HIP |
constexpr DeviceType | kMSNPU = DeviceType::MSNPU |
constexpr DeviceType | kXLA = DeviceType::XLA |
constexpr size_t | gAlignment = 64 |
constexpr int | COMPILE_TIME_MAX_DEVICE_TYPES |
constexpr auto | kStrided = Layout::Strided |
constexpr auto | kSparse = Layout::Sparse |
***But this will be problematic Consider | this |
***But this will be problematic Consider *Compiler will compain about ambiguity between the copy constructor and the *Device constructor | because |
***But this will be problematic Consider *Compiler will compain about ambiguity between the copy constructor and the *Device constructor we templatize the Device constructor Since overload *resolution is done before template | resolution |
std::atomic< int > | num_threads {1} |
constexpr struct c10::trivial_init_t | trivial_init |
constexpr struct c10::in_place_t | in_place |
constexpr nullopt_t | nullopt {nullopt_t::init()} |
To register your own kernel for an operator, do in one (!) cpp file: C10_REGISTER_KERNEL(OperatorHandle) .kernel<decltype(&kernel_func), &kernel_func>() .dispatchKey(dispatch_key);.
Simple registry implementation that uses static variables to register object creators during program initialization time.
Defines the Half type (half-precision floating-point) including conversions to standard C types and basic arithmetic operations.
This file is based on the std::array implementation of libstdc++ at https://gcc.gnu.org/onlinedocs/gcc-7.1.0/libstdc++/api/a01056_source.html.
To register your own tensor types, do in a header file: C10_DECLARE_TENSOR_TYPE(MY_TENSOR) and in one (!) cpp file: C10_DEFINE_TENSOR_TYPE(MY_TENSOR) Both must be in the same namespace.
Example:
Tensor my_kernel_cpu(Tensor in) {...}
C10_REGISTER_KERNEL(MyOpSchema) .kernel<decltype(my_kernel_cpu), &my_kernel_cpu>() .dispatchKey(CPUTensorId());
Changes:
If using std::array at runtime, feel free to either keep using std::array or use this one - it doesn't really matter. For compile time computations, this one here is preferred because std::array in C++11 misses some constexpr specifiers, forcing these methods to be called at runtime instead of compile time.
Note that arithmetic operations are implemented by converting to floating point and performing the operation in float32, instead of using CUDA half intrinisics. Most uses of this type within ATen are memory bound, including the element-wise kernels, and the half intrinisics aren't efficient on all GPUs. If you are writing a compute bound kernel, you can use the CUDA half intrinsics directly on the Half type from device code.
using c10::DeviceIndex = typedef int16_t |
using c10::KernelCacheCreatorFunction = typedef std::unique_ptr<c10::KernelCache> ( |
The type of a user-supplied function to initialize the kernel cache.
this is stored together with the KernelFunction in the DispatchTable so we can create a new cache instance when a kernel is looked up from the dispatch table.
Definition at line 26 of file DispatchTable.h.
using c10::KernelFunction = typedef void(Stack*, KernelCache* cache) |
This is the basic ABI for any kernel call.
Each kernel is registered as a function pointer KernelFunction*
, i.e. kernels are not allowed to be closures.
Definition at line 14 of file KernelFunction.h.
using c10::StreamId = typedef int32_t |
An index representing a specific stream.
A StreamId is not independently meaningful without knowing the Device it is associated with; try to use Stream rather than StreamId directly.
StreamIds are opaque; they are assigned by some DeviceType-specific numbering system which is not visible to the user. HOWEVER, we guarantee that StreamId 0 is always a valid stream, and corresponds to some sort of "default" stream.
|
strong |
This legacy enum class defines the set of backends supported by old school, code generated Type-based ATen.
The reason we are sunsetting this enum class is because it doesn't allow for open registration of backends. TensorTypeId is the replacement for Backend which supports open registration.
ARE YOU SURE YOU WANT TO USE THIS TYPE? Think about if SparseCPU/SparseCUDA would make sense in your use case. If it doesn't make sense, maybe you want DeviceType.
|
inline |
Convenience function that returns a TensorOptions
object with the device
set to the given one.
Definition at line 489 of file TensorOptions.h.
|
inline |
Convenience function that returns a TensorOptions
object with the device
set to CUDA and the device_index
set to the given one.
Definition at line 495 of file TensorOptions.h.
|
inline |
Convenience function that returns a TensorOptions
object with the dtype
set to the given one.
Definition at line 472 of file TensorOptions.h.
|
inline |
Convenience function that returns a TensorOptions
object with the layout
set to the given one.
Definition at line 483 of file TensorOptions.h.
|
inline |
Like try_make_tempfile
, but throws an exception if a temporary file could not be returned.
Definition at line 97 of file tempfile.h.
C10_EXPORT bool c10::ParseCommandLineFlags | ( | int * | pargc, |
char *** | pargv | ||
) |
Parses the commandline flags.
This command parses all the commandline arguments passed in via pargc and argv. Once it is finished, partc and argv will contain the remaining commandline args that c10 does not deal with. Note that following convention, argv[0] contains the binary name and is not parsed.
Definition at line 38 of file flags_use_no_gflags.cpp.
|
inline |
Convenience function that returns a TensorOptions
object with the requires_grad
set to the given one.
Definition at line 501 of file TensorOptions.h.
C10_API void c10::SetAllocator | ( | DeviceType | t, |
Allocator * | alloc | ||
) |
Set the allocator for DeviceType t
.
The passed in allocator pointer is expected to have static lifetime; this function does NOT take ownership of the raw pointer. (The reason for this is to prevent existing pointers to an allocator of a particular device from being invalidated when SetAllocator is called.)
Also note that this is not thread-safe, and we assume this function will only be called during initialization.
Definition at line 21 of file Allocator.cpp.
C10_API void c10::ShowLogInfoToStderr | ( | ) |
A utility to allow one to show log info to stderr after the program starts.
This is similar to calling GLOG's –logtostderr, or setting caffe2_log_level to smaller than INFO. You are recommended to only use this in a few sparse cases, such as when you want to write a tutorial or something. Normally, use the commandline flags to set the log level.
Definition at line 182 of file Logging.cpp.
c10::TensorOptions | ( | T && | device | ) |
A class to encapsulate construction axes of an Tensor.
TensorOptions was designed to support the Python style API for specifying construction options on factory functions, e.g.,
torch.zeros(2, 3, dtype=torch.int32)
Because C++ doesn't natively support keyword arguments, there must be another way of specifying keyword-like arguments. TensorOptions is a builder class which can be used to construct this "dictionary" of keyword arguments: functions which support TensorOptions conventionally take this argument optionally as their last argument.
WARNING: In PyTorch, there are torch::
variants of factory functions, e.g., torch::zeros for at::zeros. These return Variables (while the stock ATen functions return plain Tensors). If you mix these functions up, you WILL BE SAD.
Rather than use the constructor of this class directly, you should prefer to use the constructor functions, and then chain setter methods on top of them.
at::device(at::kCUDA).dtype(kInt) at::dtype(at::kInt)
Additionally, anywhere a TensorOptions is expected, you can directly pass at::kCUDA / at::kInt, and it will implicitly convert to a TensorOptions.
Here are some recommended ways to create a 2x2 tensor of zeros with certain properties. These all implicitly make use of TensorOptions, even if they don't mention the class explicitly:
at::zeros({2,2}, at::kCUDA); at::zeros({2,2}, at::kLong); at::zeros({2,2}, at::device(at::kCUDA).dtype(at::kLong())); at::zeros({2,2}, at::device({at::kCUDA, 1})); // place on device 1 at::zeros({2,2}, at::requires_grad());
NOTE [ TensorOptions Constructors ]
TensorOptions is like a dictionary with entries from the set: {requires_grad, is_variable, device, dtype, layout}, where each entry may be unspecified (i.e., is optional). It is used to specify the properties of tensors in many places both in C++ internal and API, e.g., tensor factory methods like at::empty({10}, options)
, tensor conversions like tensor.to(...)
, etc.
To provide a simple API that is consistent with Python, where one can do torch.empty(sizes, X)
with X
being a torch.device
, torch.dtype
, or a torch.layout
, we want TensorOptions to be implicitly convertible from ScalarType dtype
, Layout layout
and Device device
. Therefore, we have three implicit constructors from each of these three types.
This is sufficient for ScalarType
and Layout
as they are simple Enum classes. However, Device
is an ordinary class with implicit constructors Device(DeviceType, DeviceIndex = -1)
and Device(std::string)
to be consistent with Python API, where strings are treated as equivalent with a torch.device
object (e.g., "cuda:1" can be passed to everywhere a torch.device("cuda:1")
is accepted). To support the syntax at::empty({10}, {kCUDA, 1})
and tensor.to(kCUDA)
, we need to make sure that TensorOptions
is implicitly constructible with any argments that a Device
can constructed from. So we have,
/* implicit
Definition at line 80 of file TensorOptions.h.
|
inline |
Attempts to return a temporary file or returns nullopt
if an error ocurred.
The file returned follows the pattern <tmp-dir>/<name-prefix><random-pattern>
, where <tmp-dir>
is the value of the "TMPDIR"
, "TMP"
, "TEMP"
or "TEMPDIR"
environment variable if any is set, or otherwise /tmp
; <name-prefix>
is the value supplied to this function, and <random-pattern>
is a random sequence of numbers. On Windows, name_prefix
is ignored and tmpnam
is used.
Definition at line 81 of file tempfile.h.
* * * But this will be problematic Consider * Compiler will compain about ambiguity between the copy constructor and the* Device constructor c10::because |
Definition at line 92 of file TensorOptions.h.
constexpr int c10::COMPILE_TIME_MAX_DEVICE_TYPES |
Definition at line 35 of file DeviceType.h.