MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / MinStorageSize

Function MinStorageSize

oneflow/core/framework/tensor_methods.cpp:70–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70static int64_t MinStorageSize(const std::vector<int64_t>& sizes,
71 const std::vector<int64_t>& strides, int64_t storage_offset) {
72 int64_t storage_size = storage_offset + 1;
73 int64_t ndim = sizes.size();
74 for (size_t i = 0; i < ndim; i++) {
75 auto size_i = sizes[i];
76 if (size_i == 0) { return storage_offset; }
77 storage_size += (size_i - 1) * strides[i];
78 }
79 return storage_size;
80}
81
82Maybe<Tensor> BasicView(const std::shared_ptr<Tensor>& input, const Shape& target_shape,
83 const int64_t storage_offset) {

Callers 1

AsStridedGradFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected