/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
c10
/
core
/
/usr/local/lib64/python3.6/site-packages/torch/include/c10/core
mkdir
upload
Name
Size
Mode
Actions
impl/
-
0755
rm
Allocator.h
8725
0644
edit
dl
rm
AutogradState.h
994
0644
edit
dl
rm
Backend.h
8487
0644
edit
dl
rm
CompileTimeFunctionPointer.h
1677
0644
edit
dl
rm
CopyBytes.h
1229
0644
edit
dl
rm
CPUAllocator.h
2267
0644
edit
dl
rm
DefaultDtype.h
394
0644
edit
dl
rm
DefaultTensorOptions.h
1032
0644
edit
dl
rm
Device.h
5396
0644
edit
dl
rm
DeviceGuard.h
7555
0644
edit
dl
rm
DeviceType.h
2994
0644
edit
dl
rm
DispatchKey.h
18069
0644
edit
dl
rm
DispatchKeySet.h
12951
0644
edit
dl
rm
Event.h
4169
0644
edit
dl
rm
GeneratorImpl.h
3713
0644
edit
dl
rm
GradMode.h
1261
0644
edit
dl
rm
InferenceMode.h
3471
0644
edit
dl
rm
Layout.h
1225
0644
edit
dl
rm
MemoryFormat.h
8571
0644
edit
dl
rm
OptionalRef.h
521
0644
edit
dl
rm
QEngine.h
861
0644
edit
dl
rm
QScheme.h
1562
0644
edit
dl
rm
Scalar.h
6019
0644
edit
dl
rm
ScalarType.h
17073
0644
edit
dl
rm
ScalarTypeToTypeMeta.h
1365
0644
edit
dl
rm
Storage.h
4369
0644
edit
dl
rm
StorageImpl.h
5610
0644
edit
dl
rm
Stream.h
7373
0644
edit
dl
rm
StreamGuard.h
6315
0644
edit
dl
rm
TensorImpl.h
96152
0644
edit
dl
rm
TensorOptions.h
27593
0644
edit
dl
rm
thread_pool.h
2992
0644
edit
dl
rm
UndefinedTensorImpl.h
911
0644
edit
dl
rm
WrapDimMinimal.h
805
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/c10/core/Storage.h
(4369B)
#pragma once #include <c10/core/StorageImpl.h> namespace c10 { struct C10_API Storage { public: struct use_byte_size_t {}; Storage() {} Storage(c10::intrusive_ptr<StorageImpl> ptr) : storage_impl_(std::move(ptr)) {} // Allocates memory buffer using given allocator and creates a storage with it Storage( use_byte_size_t use_byte_size, size_t size_bytes, Allocator* allocator = nullptr, bool resizable = false) : storage_impl_(c10::make_intrusive<StorageImpl>( StorageImpl::use_byte_size_t(), size_bytes, allocator, resizable)) {} // Creates storage with pre-allocated memory buffer. Allocator is given for // potential future reallocations, however it can be nullptr if the storage // is non-resizable Storage( use_byte_size_t use_byte_size, size_t size_bytes, at::DataPtr data_ptr, at::Allocator* allocator = nullptr, bool resizable = false) : storage_impl_(c10::make_intrusive<StorageImpl>( StorageImpl::use_byte_size_t(), size_bytes, std::move(data_ptr), allocator, resizable)) {} // Legacy constructor for partially initialized (dtype or memory) storages // that can be temporarily created with Caffe2 APIs. See the note on top of // TensorImpl.h for details. static Storage create_legacy(at::Device device) { auto allocator = GetAllocator(device.type()); return Storage(c10::make_intrusive<StorageImpl>( StorageImpl::use_byte_size_t(), 0, allocator->allocate(0), // materialize a non-default Device. allocator, true)); } template <typename T> T* data() const { return storage_impl_->data<T>(); } template <typename T> T* unsafe_data() const { return storage_impl_->unsafe_data<T>(); } // TODO: remove later void set_nbytes(size_t size_bytes) const { storage_impl_.get()->set_nbytes(size_bytes); } bool resizable() const { return storage_impl_->resizable(); } size_t nbytes() const { return storage_impl_->nbytes(); } // get() use here is to get const-correctness void* data() const { return storage_impl_.get()->data(); } at::DataPtr& data_ptr() { return storage_impl_->data_ptr(); } const at::DataPtr& data_ptr() const { return storage_impl_->data_ptr(); } // Returns the previous data_ptr at::DataPtr set_data_ptr(at::DataPtr&& data_ptr) const { return storage_impl_.get()->set_data_ptr(std::move(data_ptr)); } void set_data_ptr_noswap(at::DataPtr&& data_ptr) const { return storage_impl_.get()->set_data_ptr_noswap(std::move(data_ptr)); } DeviceType device_type() const { return storage_impl_->device_type(); } at::Allocator* allocator() const { return storage_impl_.get()->allocator(); } at::Device device() const { return storage_impl_->device(); } StorageImpl* unsafeReleaseStorageImpl() { return storage_impl_.release(); } StorageImpl* unsafeGetStorageImpl() const noexcept { return storage_impl_.get(); } c10::weak_intrusive_ptr<StorageImpl> getWeakStorageImpl() const { return c10::weak_intrusive_ptr<StorageImpl>(storage_impl_); } operator bool() const { return storage_impl_; } size_t use_count() const { return storage_impl_.use_count(); } inline bool unique() const { return storage_impl_.unique(); } bool is_alias_of(const Storage& other) const { return storage_impl_ == other.storage_impl_; } void UniqueStorageShareExternalPointer( void* src, size_t capacity, DeleterFnPtr d = nullptr) { if (!storage_impl_.unique()) { TORCH_CHECK( false, "UniqueStorageShareExternalPointer can only be called when use_count == 1"); } storage_impl_->UniqueStorageShareExternalPointer(src, capacity, d); } void UniqueStorageShareExternalPointer( at::DataPtr&& data_ptr, size_t capacity) { if (!storage_impl_.unique()) { TORCH_CHECK( false, "UniqueStorageShareExternalPointer can only be called when use_count == 1"); } storage_impl_->UniqueStorageShareExternalPointer( std::move(data_ptr), capacity); } protected: c10::intrusive_ptr<StorageImpl> storage_impl_; }; } // namespace c10
Save
cmd:
run