/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
TH
/
/usr/local/lib64/python3.6/site-packages/torch/include/TH
mkdir
upload
Name
Size
Mode
Actions
generic/
-
0755
rm
TH.h
126
0644
edit
dl
rm
THGeneral.h
4903
0644
edit
dl
rm
THGenerateAllTypes.h
411
0644
edit
dl
rm
THGenerateBFloat16Type.h
427
0644
edit
dl
rm
THGenerateBoolType.h
373
0644
edit
dl
rm
THGenerateByteType.h
376
0644
edit
dl
rm
THGenerateCharType.h
375
0644
edit
dl
rm
THGenerateComplexDoubleType.h
438
0644
edit
dl
rm
THGenerateComplexFloatType.h
433
0644
edit
dl
rm
THGenerateComplexTypes.h
442
0644
edit
dl
rm
THGenerateDoubleType.h
382
0644
edit
dl
rm
THGenerateFloatType.h
377
0644
edit
dl
rm
THGenerateFloatTypes.h
420
0644
edit
dl
rm
THGenerateHalfType.h
396
0644
edit
dl
rm
THGenerateIntType.h
372
0644
edit
dl
rm
THGenerateIntTypes.h
514
0644
edit
dl
rm
THGenerateLongType.h
376
0644
edit
dl
rm
THGenerateQInt8Type.h
508
0644
edit
dl
rm
THGenerateQInt32Type.h
513
0644
edit
dl
rm
THGenerateQTypes.h
480
0644
edit
dl
rm
THGenerateQUInt4x2Type.h
520
0644
edit
dl
rm
THGenerateQUInt8Type.h
514
0644
edit
dl
rm
THGenerateShortType.h
380
0644
edit
dl
rm
THHalf.h
97
0644
edit
dl
rm
THStorage.h
125
0644
edit
dl
rm
THStorageFunctions.h
1116
0644
edit
dl
rm
THStorageFunctions.hpp
1297
0644
edit
dl
rm
THTensor.h
514
0644
edit
dl
rm
THTensor.hpp
4061
0644
edit
dl
rm
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 <TH/THTensor.h> #include <TH/THStorageFunctions.hpp> #include <atomic> #include <ATen/ATen.h> // 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<at::TensorImpl>::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<int64_t> 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 <TH/generic/THTensor.hpp> #include <TH/THGenerateAllTypes.h> #include <TH/generic/THTensor.hpp> #include <TH/THGenerateComplexTypes.h> #include <TH/generic/THTensor.hpp> #include <TH/THGenerateHalfType.h> #include <TH/generic/THTensor.hpp> #include <TH/THGenerateBoolType.h> #include <TH/generic/THTensor.hpp> #include <TH/THGenerateBFloat16Type.h>
Save
cmd:
run