MCPcopy Create free account
hub / github.com/MegEngine/MegCC / tensor_length_in_byte

Function tensor_length_in_byte

runtime/src/init.h:50–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static inline size_t tensor_length_in_byte(const Tensor* tensor) {
51 Layout layout = tensor->layout;
52 size_t length = layout.nr_dim > 0 ? 1 : 0;
53 for (int i = 0; i < layout.nr_dim; i++) {
54 int stride = layout.stride[i] > 0 ? layout.stride[i] : -layout.stride[i];
55 length += stride * (layout.dims[i] - 1);
56 }
57 length *= dtype_length((tensor)->dtype.type_enum, NULL);
58 return length;
59}
60#endif

Callers 13

proxy_kernelFunction · 0.85
parse_tensorFunction · 0.85
parse_weightFunction · 0.85
LITE_reset_tensor_memoryFunction · 0.85
executeFunction · 0.85
execute_setsubtensorFunction · 0.85
alloc_device_tensorFunction · 0.85
alloc_tensor_optFunction · 0.85
print_tensorFunction · 0.85

Calls 1

dtype_lengthFunction · 0.85

Tested by 1

proxy_kernelFunction · 0.68