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

Function get_tensor_value

runtime/src/tensor_util.h:95–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95static inline int32_t get_tensor_value(const Tensor* tensor, int index) {
96 if (tensor->dtype.type_enum == TinyNN_FLOAT) {
97 return *((float*)(tensor->ptr) + index);
98 } else if (tensor->dtype.type_enum == TinyNN_INT) {
99 return *((int32_t*)(tensor->ptr) + index);
100 } else if (tensor->dtype.type_enum == TinyNN_INT8) {
101 return *((int8_t*)(tensor->ptr) + index);
102 } else {
103 TINYNN_ASSERT_MSG(0, "unsupport dtype.\n");
104 }
105 return 0;
106}
107#endif

Callers 1

update_layoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected