MCPcopy Create free account
hub / github.com/alibaba/MNN / Tensor

Method Tensor

source/core/Tensor.cpp:20–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19namespace MNN {
20Tensor::Tensor(int dimSize, DimensionType type) {
21 MNN_ASSERT(dimSize <= MNN_MAX_TENSOR_DIM);
22 mDescribe = new InsideDescribe;
23 mDescribe->mContent.reset(new InsideDescribe::NativeInsideDescribe);
24 auto nativeDescribe = mDescribe->mContent.get();
25 mBuffer.dimensions = dimSize;
26 mBuffer.type = halide_type_of<float>();
27 mBuffer.device = 0;
28 mBuffer.host = nullptr;
29 mBuffer.dim = &nativeDescribe->dims[0];
30 mBuffer.flags = 0;
31
32 switch (type) {
33 case CAFFE:
34 nativeDescribe->dimensionFormat = MNN_DATA_FORMAT_NCHW;
35 break;
36 case TENSORFLOW:
37 nativeDescribe->dimensionFormat = MNN_DATA_FORMAT_NHWC;
38 break;
39 case CAFFE_C4:
40 nativeDescribe->dimensionFormat = MNN_DATA_FORMAT_NC4HW4;
41 break;
42 default:
43 break;
44 }
45}
46
47Tensor::Tensor(const Tensor* tensor, DimensionType type, bool allocMemory) {
48 MNN_ASSERT(tensor != nullptr);

Callers 5

_decompose_moduleFunction · 0.45
_generate_prune_maskMethod · 0.45
compute_clFunction · 0.45
compute_cl_2Function · 0.45
forwardMethod · 0.45

Calls 10

MNNMemoryAllocAlignFunction · 0.85
getDimensionTypeMethod · 0.80
setBackendMethod · 0.80
sizeFunction · 0.70
resetMethod · 0.45
getMethod · 0.45
bufferMethod · 0.45
push_backMethod · 0.45
getBackendMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected