/usr/local/lib64/python3.6/site-packages/torch/include/TH
NameSizeModeActions
generic/-0755rm
TH.h1260644editdlrm
THGeneral.h49030644editdlrm
THGenerateAllTypes.h4110644editdlrm
THGenerateBFloat16Type.h4270644editdlrm
THGenerateBoolType.h3730644editdlrm
THGenerateByteType.h3760644editdlrm
THGenerateCharType.h3750644editdlrm
THGenerateComplexDoubleType.h4380644editdlrm
THGenerateComplexFloatType.h4330644editdlrm
THGenerateComplexTypes.h4420644editdlrm
THGenerateDoubleType.h3820644editdlrm
THGenerateFloatType.h3770644editdlrm
THGenerateFloatTypes.h4200644editdlrm
THGenerateHalfType.h3960644editdlrm
THGenerateIntType.h3720644editdlrm
THGenerateIntTypes.h5140644editdlrm
THGenerateLongType.h3760644editdlrm
THGenerateQInt8Type.h5080644editdlrm
THGenerateQInt32Type.h5130644editdlrm
THGenerateQTypes.h4800644editdlrm
THGenerateQUInt4x2Type.h5200644editdlrm
THGenerateQUInt8Type.h5140644editdlrm
THGenerateShortType.h3800644editdlrm
THHalf.h970644editdlrm
THStorage.h1250644editdlrm
THStorageFunctions.h11160644editdlrm
THStorageFunctions.hpp12970644editdlrm
THTensor.h5140644editdlrm
THTensor.hpp40610644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/TH/THTensor.hpp (4061B)
#pragma once // STOP!!! Thinking of including this header directly? Please // read Note [TH abstraction violation] #include #include #include #include // Returns a Tensor given a TensorImpl. The TensorImpl remains valid after the // the Tensor is destroyed. inline at::Tensor THTensor_wrap(THTensor* tensor) { c10::raw::intrusive_ptr::incref(tensor); return at::Tensor(c10::intrusive_ptr::reclaim(tensor)); } inline const int64_t* THTensor_getSizePtr(THTensor* tensor) { return tensor->sizes().data(); } inline const int64_t* THTensor_getStridePtr(THTensor* tensor) { return tensor->strides().data(); } // NB: Non-retaining inline THStorage* THTensor_getStoragePtr(const THTensor* tensor) { // Within PyTorch, the invariant is that storage_ is always // initialized; we never have tensors that don't have any storage. // However, for Caffe2, this is not true, because they have permitted // tensors to be allocated without specifying what scalar type // they should be, only to be filled when GetMutableData is called // for the first time (providing the necessary type). It is an ERROR to // invoke any PyTorch operations on such a half-constructed storage, // and this check tests for that case. TORCH_CHECK(tensor->storage(), "Cannot use PyTorch operations on a half-constructed " "tensor. If this tensor came from Caffe2, please call GetMutableData on " "it first; otherwise, this is a bug, please report it."); return tensor->storage().unsafeGetStorageImpl(); } // [NOTE: nDimension vs nDimensionLegacyNoScalars vs nDimensionLegacyAll] // nDimension corresponds to the "true" ATen dimension. // nDimensionLegacyNoScalars corresponds to the ATen dimension, except scalars are viewed as 1-dimensional tensors. // nDimensionLegacyAll corresponds to the ATen dimension, except scalars are viewed as 1-dimensional tensors // and tensors with a dimension of size zero are collapsed to 0-dimensional tensors. // // Eventually, everything should go through nDimension or tensor->dim(). inline int THTensor_nDimension(const THTensor* tensor) { return tensor->dim(); } inline int THTensor_nDimensionLegacyNoScalars(const THTensor* tensor) { if (tensor->dim() == 0) { return 1; } else { return tensor->dim(); } } inline int THTensor_nDimensionLegacyAll(const THTensor* tensor) { if (tensor->is_empty()) { return 0; } else if (tensor->dim() == 0) { return 1; } else { return tensor->dim(); } } inline int64_t THTensor_strideLegacyNoScalars(const THTensor *self, int dim) { THArgCheck((dim >= 0) && (dim < THTensor_nDimensionLegacyNoScalars(self)), 2, "dimension %d out of range of %dD tensor", dim, THTensor_nDimensionLegacyNoScalars(self)); return self->dim() == 0 ? 1 : self->stride(dim); } inline int64_t THTensor_sizeLegacyNoScalars(const THTensor *self, int dim) { THArgCheck((dim >= 0) && (dim < THTensor_nDimensionLegacyNoScalars(self)), 2, "dimension %d out of range of %dD tensor", dim, THTensor_nDimensionLegacyNoScalars(self)); return self->dim() == 0 ? 1 : self->size(dim); } inline std::vector THTensor_sizesLegacyNoScalars(const THTensor *self) { if (self->dim() == 0) { return {1}; } else { return self->sizes().vec(); } } TH_API void THTensor_free(THTensor *self); TH_CPP_API void THTensor_resize(THTensor *self, at::IntArrayRef size, at::IntArrayRef stride); TH_CPP_API void THTensor_setStorage(THTensor *self, THStorage *storage_, ptrdiff_t storageOffset_, at::IntArrayRef size_, at::IntArrayRef stride_); #include #include #include #include #include #include #include #include #include #include