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

Function dtype_length

runtime/src/init.h:28–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26TinyNNStatus init_model_memory(CombineModel* model);
27
28static inline int dtype_length(TinyNNDType dtype, TinyNNStatus* error) {
29 switch (dtype) {
30 case TinyNN_FLOAT:
31 case TinyNN_INT:
32 case TinyNN_QINT32:
33 return 4;
34 case TinyNN_FLOAT16:
35 case TinyNN_INT16:
36 return 2;
37 case TinyNN_INT8:
38 case TinyNN_UINT8:
39 case TinyNN_QINT8:
40 return 1;
41 default: {
42 LOG_ERROR("no support data type. enum value is %d\n", (int)dtype);
43 if (error)
44 *error = TinyNN_ERROR_NO_IMPLEMENT;
45 }
46 }
47 tinynn_trap();
48}
49
50static inline size_t tensor_length_in_byte(const Tensor* tensor) {
51 Layout layout = tensor->layout;

Callers 7

tensor_length_in_byteFunction · 0.85
execute_single_oprFunction · 0.85
update_layoutFunction · 0.85
execute_subtensorFunction · 0.85
execute_setsubtensorFunction · 0.85
execute_broadcastFunction · 0.85
executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected