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

Function OFShapeToNumpyShape

oneflow/extension/python/numpy.cpp:85–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85std::vector<size_t> OFShapeToNumpyShape(const DimVector& fixed_vec) {
86 size_t ndim = fixed_vec.size();
87 auto result = std::vector<size_t>(ndim);
88 for (int i = 0; i < ndim; i++) { result[i] = fixed_vec.at(i); }
89 return result;
90}
91
92// NumPy strides use bytes. OneFlow strides use element counts.
93std::vector<size_t> OFStrideToNumpyStride(const Stride& stride, const DataType data_type) {

Callers 1

EagerLocalTensorToNumpyFunction · 0.85

Calls 2

sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected