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

Function is_equal_tensor_layout

runtime/src/init.c:12–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "vm/instruction.h"
11
12static int is_equal_tensor_layout(Tensor* tensor0, Tensor* tensor1) {
13 if (tensor0->dtype.type_enum != tensor1->dtype.type_enum) {
14 return 0;
15 }
16 Layout layout0 = tensor0->layout;
17 Layout layout1 = tensor1->layout;
18 if (layout0.nr_dim != layout1.nr_dim) {
19 return 0;
20 }
21 for (int i = 0; i < layout0.nr_dim; ++i) {
22 if (layout0.dims[i] != layout1.dims[i]) {
23 return 0;
24 }
25 }
26 return 1;
27}
28
29static int get_ins_nr_processed_weights(Opr* opr, DeviceModel* model) {
30 int init_index = opr->init_func;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected