/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/SparseTensorUtils.h (4219B)
#pragma once #include #include #include namespace at { namespace sparse { // Just for documentary purposes using SparseTensor = Tensor; using SparseType = Type; // This is an internal utility function for getting at the SparseTensorImpl, // so that we can write sparse tensor specific accessors for special fields // in SparseTensor. You should only use this for writing low level // setters/getters for SparseTensorImpl fields; otherwise, you should use // the low level setters/getters that were implemented using this. // // This may be called repeatedly, so make sure it's pretty cheap. inline SparseTensorImpl* get_sparse_impl(const SparseTensor& self) { TORCH_INTERNAL_ASSERT(self.is_sparse(), "_internal_get_SparseTensorImpl: not a sparse tensor"); return static_cast(self.unsafeGetTensorImpl()); } // Takes indices and values and directly puts them into the sparse tensor, no // copy. This used to be called THSTensor_(_move) inline void alias_into_sparse(const SparseTensor& self, const Tensor& indices, const Tensor& values) { get_sparse_impl(self)->set_indices_and_values_unsafe(indices, values); } // Take indices and values and makes a (data) copy of them to put into the sparse // indices/values. This used to be called THSTensor_(_set) inline void copy_into_sparse(const SparseTensor& self, const Tensor& indices, const Tensor& values, bool non_blocking) { alias_into_sparse( self, indices.to(self._indices().options(), non_blocking, /*copy=*/true), values.to(self._values().options(), non_blocking, /*copy=*/true)); } // TODO: put this into the public API inline bool is_same_tensor(const Tensor& lhs, const Tensor& rhs) { return lhs.unsafeGetTensorImpl() == rhs.unsafeGetTensorImpl(); } inline bool is_same_density(const SparseTensor& self, const SparseTensor& src) { return self.sparse_dim() == src.sparse_dim() && self.dense_dim() == src.dense_dim(); } // Give us a new values tensor, with the same dimensionality // as 'values' but with a new number of non-zero elements. // TODO: Expose this for real in ATen, some day? // NB: Doesn't preserve data. inline Tensor new_values_with_size_of(const Tensor& values, int64_t nnz) { std::vector size = values.sizes().vec(); size[0] = nnz; return at::empty(size, values.options()); } // NOTE [ Flatten Sparse Indices ] // This helper function flattens a sparse indices tensor (a Tensor) into a 1D // indices tensor. E.g., // input = [[2, 4, 0], // [3, 1, 10]] // full_size = [2, 12] // output = [ 2 * 12 + 3, 4 * 12 + 1, 0 * 12 + 10 ] = [27, 49, 10] // // In other words, assuming that each `indices[i, :]` is a valid index to a // tensor `t` of shape `full_size`. This returns the corresponding indices to // the flattened tensor `t.reshape( prod(full_size[:indices.size(0)]), -1 )`. // if forceClone is true, the result will forced to be a clone of self. // if force_clone is true, the result will forced to be a clone of self. TORCH_API Tensor flatten_indices(const Tensor& indices, IntArrayRef full_size, bool force_clone = false); // Flatten sparse tensor's indices from nD to 1D, similar to NOTE [ Flatten Sparse Indices ], // except this one allows partial flatten: only flatten on specified dims. Note that // the flatten indices might be uncoalesced if dims_to_flatten.size() < sparse_dim. // Also if input indices is already coalesced, the flattened indices will also be sorted. // // args: // indices: sparse tensor indices // sizes: sparse tensor sizes // dims_to_flatten: a list of dim index to flatten // // Ex1: // indices = [[2, 4, 0], // [3, 1, 3]] // sizes = [2, 12] // dims_to_flatten = [0, 1] // new_indices = [ 2 * 12 + 3, 4 * 12 + 1, 0 * 12 + 3 ] = [27, 49, 3] // // Ex2: // dims_to_flatten = [1] // new_indices = [ 3, 1, 3 ] # uncoalesced TORCH_API Tensor flatten_indices_by_dims(const Tensor& indices, const IntArrayRef& sizes, const IntArrayRef& dims_to_flatten); // Find the CSR representation for a row `indices` from the COO format TORCH_API Tensor coo_to_csr(const int64_t* indices, int64_t dim, int64_t nnz); }} // namespace at::sparse