/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/NamedTensorUtils.h (5747B)
#pragma once #include #include #include #include #include namespace at { using NameVector = SmallVector; inline bool has_names(TensorList tensors) { return std::any_of( tensors.begin(), tensors.end(), [](const Tensor& t) { return t.has_names(); }); } // Converts dim to an positional index. Errors if `dim` cannot be used to // refer to any dimension of tensor. TORCH_API int64_t dimname_to_position(const Tensor& tensor, Dimname dim); TORCH_API std::vector dimnames_to_positions(const Tensor& tensor, DimnameList dims); // Unifies two DimnameList to produce a third. This is useful for implementing // the named inference rule for binary broadcasting operations like add. // // There are three main constraints: // 1) Check matching: Names must match positionally from the right. // 2) Check misaligned: If a name `n` is in `names`, then it must appear at // the same index from the right in other. // 3) The output names are obtained by unifying the names individually from the right. TORCH_API std::vector unify_from_right(DimnameList names, DimnameList other, const char* action = "broadcast"); [[noreturn]] inline void reportNYIDimnameOverload(const char* op_name) { TORCH_CHECK( false, op_name, ": You passed a dimname (string) to this op in place of a dimension " "index but it does not yet support this behavior. Please pass a dimension " "index to work around this."); } // [NOTE] Writing name inference rules // // Operators that support named tensors are either composed of operations that // support named tensors or implement some name inference rule. An op that // implements its own name inference rule generally looks like the following: // // Tensor op(...) { // perform_shape_checks(...); // # (1) // auto maybe_outnames = compute_outnames(...); // auto result = [&]() { // NoNamesGuard guard; // return op_impl(...); // }(); // # (2) // propagate_names_if_nonempty(result, maybe_outnames); // // Each op has (1) a compute outnames step and (2) a propagate names step. // // compute_outnames is responsible for checking that input names match and // determining what the output names should be. It returns either: // - {} (if the inputs tensors are all unnamed) // - non-empty outnames. // // propagate_names_if_nonempty propagates the outnames if they exist to the result // tensors. // // The {} case is an optimization; if the user does not use named tensors they // pay no perf cost for it. namespace namedinference { // Propagates `names` to `result` if `names` is not empty. // `names` can be empty; see [NOTE] Writing name inference rules // If `names` is not empty, `names.size()` should equal `result.dim()`. // When in doubt, use this overload instead of the others. TORCH_API const Tensor& propagate_names_if_nonempty( const Tensor& result, DimnameList maybe_names, bool validate_names = false); // Propagates `names` to `result`. Only use this if we are certain that there are // names to propagate (that names is not empty). TORCH_API const Tensor& propagate_names( const Tensor& result, DimnameList names, bool validate_names = false); // Propagates all names from src to result. TORCH_API void propagate_names(const Tensor& result, const Tensor& src); // Propagates all names except for those at the excluded_idxs. TORCH_API void propagate_names_except(const Tensor& result, const Tensor& src, IntArrayRef excluded_idxs); // Used for reduction ops that have a `keepdim` arg. TORCH_API void propagate_names_for_reduction(const Tensor& result, const Tensor& src, IntArrayRef excluded_idxs, bool keepdim); TORCH_API void propagate_names_for_expand(const Tensor& result, const Tensor& self); TORCH_API std::vector compute_cat_outnames(TensorList tensors); TORCH_API std::vector compute_broadcast_outnames( const Tensor& self, const Tensor& other); TORCH_API std::vector broadcast_to_outnames( const Tensor& tensor, const Tensor& reference_tensor, const char* op_name); TORCH_API std::vector compute_matmul_outnames(const Tensor& self, const Tensor& other); TORCH_API std::vector compute_cdist_outnames(const Tensor& self, const Tensor& other); TORCH_API std::vector compute_bmm_outnames( Tensor& result, const Tensor& self, const Tensor& other); TORCH_API std::vector compute_squeeze_outnames(const Tensor& tensor); std::vector compute_diagonal_outnames( const Tensor& tensor, int64_t dim1, int64_t dim2); // TensorImpl* overloads for Legacy TH/THC code. Use these sparingly. TORCH_API TensorImpl* propagate_names_if_nonempty( TensorImpl* result, DimnameList maybe_names, bool validate_names = false); TORCH_API TensorImpl* propagate_names( TensorImpl* result, DimnameList names, bool validate_names = false); TORCH_API void propagate_names(TensorImpl* result, /*const */TensorImpl* src); // result = m1 @ m2 + bias TORCH_API std::vector propagate_names_for_addmm( const Tensor& m1, const Tensor& m2, const Tensor& bias); TORCH_API std::vector propagate_names_for_addmv( const Tensor& mat, const Tensor& vec, const Tensor& bias); TORCH_API void check_names_for_dot(TensorImpl* vec1, TensorImpl* vec2); TORCH_API std::vector compute_baddbmm_outnames( Tensor& result, const Tensor& self, const Tensor& other, const Tensor& bias); TORCH_API bool are_names_equal(TensorImpl* self, TensorImpl* other); } // namespace namedinference } // namespace at