/usr/local/lib64/python3.6/site-packages/torch/include/ATen
NameSizeModeActions
core/-0755rm
cpu/-0755rm
cuda/-0755rm
cudnn/-0755rm
detail/-0755rm
hip/-0755rm
native/-0755rm
quantized/-0755rm
AccumulateType.h44380644editdlrm
ArrayRef.h440644editdlrm
ATen.h9980644editdlrm
autocast_mode.h67160644editdlrm
Backend.h430644editdlrm
Backtrace.h460644editdlrm
BatchedFallback.h9650644editdlrm
BatchedTensorImpl.h53830644editdlrm
CompositeExplicitAutogradFunctions.h16220644editdlrm
CompositeExplicitAutogradFunctions_inl.h540750644editdlrm
CompositeImplicitAutogradFunctions.h16220644editdlrm
CompositeImplicitAutogradFunctions_inl.h1420820644editdlrm
Config.h7340644editdlrm
Context.h127670644editdlrm
cpp_custom_type_hack.h53260644editdlrm
CPUApplyUtils.h125820644editdlrm
CPUFixedAllocator.h8300644editdlrm
CPUFunctions.h16000644editdlrm
CPUFunctions_inl.h1719240644editdlrm
CPUGeneratorImpl.h14310644editdlrm
CUDAFunctions.h16010644editdlrm
CUDAFunctions_inl.h1856960644editdlrm
CUDAGeneratorImpl.h46950644editdlrm
Device.h420644editdlrm
DeviceGuard.h11340644editdlrm
Dimname.h310644editdlrm
DimVector.h460644editdlrm
Dispatch.h521370644editdlrm
div_rtn.h2040644editdlrm
DLConvertor.h5760644editdlrm
dlpack.h52440644editdlrm
DynamicLibrary.h3690644editdlrm
ExpandUtils.h145060644editdlrm
Formatting.h340644editdlrm
Functions.h8463260644editdlrm
Generator.h460644editdlrm
InferSize.h21430644editdlrm
InitialTensorOptions.h4450644editdlrm
Layout.h420644editdlrm
MapAllocator.h29990644editdlrm
MatrixRef.h30160644editdlrm
MemoryOverlap.h11170644editdlrm
MetaFunctions.h16010644editdlrm
MetaFunctions_inl.h840060644editdlrm
NamedTensor.h350644editdlrm
NamedTensorUtils.h57470644editdlrm
NativeFunctions.h3546510644editdlrm
NativeMetaFunctions.h354450644editdlrm
NumericUtils.h27870644editdlrm
OpaqueTensorImpl.h60800644editdlrm
Operators.h17071990644editdlrm
OpMathType.h4600644editdlrm
Parallel.h48750644editdlrm
ParallelNative.h24430644editdlrm
ParallelNativeTBB.h29340644editdlrm
ParallelOpenMP.h30490644editdlrm
PTThreadPool.h3940644editdlrm
record_function.h240440644editdlrm
RedispatchFunctions.h11128860644editdlrm
RegistrationDeclarations.h5457770644editdlrm
SavedTensorHooks.h3280644editdlrm
Scalar.h440644editdlrm
ScalarOps.h22720644editdlrm
ScalarType.h1290644editdlrm
SequenceNumber.h3730644editdlrm
SmallVector.h470644editdlrm
SparseCsrTensorImpl.h20450644editdlrm
SparseCsrTensorUtils.h5230644editdlrm
SparseTensorImpl.h124170644editdlrm
SparseTensorUtils.h42190644editdlrm
Storage.h430644editdlrm
Tensor.h480644editdlrm
TensorAccessor.h510644editdlrm
TensorGeometry.h18550644editdlrm
TensorIndexing.h219230644editdlrm
TensorIterator.h299620644editdlrm
TensorIteratorInternal.h18620644editdlrm
TensorMeta.h29170644editdlrm
TensorNames.h25190644editdlrm
TensorOperators.h32750644editdlrm
TensorOptions.h490644editdlrm
TensorUtils.h56870644editdlrm
ThreadLocalState.h32890644editdlrm
TracerMode.h55760644editdlrm
TypeDefault.h6800644editdlrm
Utils.h59930644editdlrm
Version.h3400644editdlrm
VmapMode.h9520644editdlrm
VmapTransforms.h76540644editdlrm
WrapDimUtils.h34380644editdlrm
WrapDimUtilsMulti.h7680644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/ATen/Utils.h (5993B)
#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define AT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ void operator=(const TypeName&) = delete namespace at { TORCH_API int _crash_if_asan(int); // TODO: This unwrapping code is ONLY used for TH bindings; once TH goes // away, we can delete this function static inline TensorImpl* checked_dense_tensor_unwrap(const Tensor& expr, const char * name, int pos, const char * api, bool allowNull, DeviceType device_type, ScalarType scalar_type) { if(allowNull && !expr.defined()) { return nullptr; } if (expr.layout() != Layout::Strided) { AT_ERROR("Expected dense tensor but got ", expr.layout(), " for argument #", pos, " '", name, "' in call to ", api); } if (expr.device().type() != device_type) { AT_ERROR("Expected object of device type ", device_type, " but got device type ", expr.device().type(), " for argument #", pos, " '", name, "' in call to ", api); } if (expr.scalar_type() != scalar_type) { AT_ERROR("Expected object of scalar type ", scalar_type, " but got scalar type ", expr.scalar_type(), " for argument #", pos, " '", name, "' in call to ", api); } return expr.unsafeGetTensorImpl(); } // Converts a TensorList (i.e. ArrayRef to vector of TensorImpl*) // NB: This is ONLY used by legacy TH bindings, and ONLY used by cat. // Once cat is ported entirely to ATen this can be deleted! static inline std::vector checked_dense_tensor_list_unwrap(ArrayRef tensors, const char * name, int pos, DeviceType device_type, ScalarType scalar_type) { std::vector unwrapped; unwrapped.reserve(tensors.size()); for (const auto i : c10::irange(tensors.size())) { const auto& expr = tensors[i]; if (expr.layout() != Layout::Strided) { AT_ERROR("Expected dense tensor but got ", expr.layout(), " for sequence element ", i , " in sequence argument at position #", pos, " '", name, "'"); } if (expr.device().type() != device_type) { AT_ERROR("Expected object of device type ", device_type, " but got device type ", expr.device().type(), " for sequence element ", i , " in sequence argument at position #", pos, " '", name, "'"); } if (expr.scalar_type() != scalar_type) { AT_ERROR("Expected object of scalar type ", scalar_type, " but got scalar type ", expr.scalar_type(), " for sequence element ", i , " in sequence argument at position #", pos, " '", name, "'"); } unwrapped.emplace_back(expr.unsafeGetTensorImpl()); } return unwrapped; } template std::array check_intlist(ArrayRef list, const char * name, int pos) { if (list.empty()) { // TODO: is this necessary? We used to treat nullptr-vs-not in IntList differently // with strides as a way of faking optional. list = {}; } auto res = std::array(); if (list.size() == 1 && N > 1) { res.fill(list[0]); return res; } if (list.size() != N) { AT_ERROR("Expected a list of ", N, " ints but got ", list.size(), " for argument #", pos, " '", name, "'"); } std::copy_n(list.begin(), N, res.begin()); return res; } /** * Utility function to static cast input Generator* to * the backend generator type (CPU/CUDAGeneratorImpl etc.) */ template static inline T * check_generator(c10::optional gen) { TORCH_CHECK(gen.has_value(), "Expected Generator but received nullopt"); TORCH_CHECK(gen->defined(), "Generator with undefined implementation is not allowed"); TORCH_CHECK(T::device_type() == gen->device().type(), "Expected a '", T::device_type(), "' device type for generator but found '", gen->device().type(), "'"); return gen->get(); } /** * Utility function used in tensor implementations, which * supplies the default generator to tensors, if an input generator * is not supplied. The input Generator* is also static casted to * the backend generator type (CPU/CUDAGeneratorImpl etc.) */ template static inline T* get_generator_or_default(const c10::optional& gen, const Generator& default_gen) { return gen.has_value() && gen->defined() ? check_generator(gen) : check_generator(default_gen); } inline void check_size_nonnegative(IntArrayRef size) { for (auto x: size) { TORCH_CHECK(x >= 0, "Trying to create tensor with negative dimension ", x, ": ", size); } } namespace detail { TORCH_API Tensor empty_cpu(IntArrayRef size, c10::optional dtype_opt, c10::optional layout_opt, c10::optional device_opt, c10::optional pin_memory_opt, c10::optional memory_format_opt); TORCH_API Tensor empty_generic( IntArrayRef size, c10::Allocator* allocator, // technically this can be inferred from the device, but usually the // correct setting is obvious from the call site so just make callers // pass it in c10::DispatchKey dispatch_key, ScalarType dtype, Device device, c10::optional memory_format ); template TORCH_API Tensor tensor_cpu(ArrayRef values, const TensorOptions& options); template TORCH_API Tensor tensor_backend(ArrayRef values, const TensorOptions& options); template TORCH_API Tensor tensor_complex_cpu(ArrayRef values, const TensorOptions& options); template TORCH_API Tensor tensor_complex_backend(ArrayRef values, const TensorOptions& options); } // namespace detail } // at