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

Function Init0

runtime/test/runtime/test_model_init.cpp:26–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25namespace {
26TinyNNStatus Init0(
27 Tensor** inputs, int nr_input, Tensor* out_weights, int* nr_out_weight,
28 const RuntimeOpt* opt) {
29 if (out_weights == NULL && nr_out_weight != NULL) {
30 *nr_out_weight = 1;
31 return TinyNN_SUCCESS;
32 }
33 Tensor* in_weights = inputs[0];
34 if (out_weights != NULL && nr_out_weight == NULL) {
35 out_weights->layout.nr_dim = 2;
36 out_weights->layout.dims[0] = 5;
37 out_weights->layout.dims[1] = 2;
38 out_weights->layout.stride[0] = 1;
39 out_weights->layout.stride[1] = 5;
40 out_weights->dtype.type_enum = TinyNN_FLOAT;
41 out_weights->name = in_weights->name;
42
43 return TinyNN_SUCCESS;
44 }
45 if (out_weights != NULL && nr_out_weight != NULL) {
46 float* data = (float*)out_weights->ptr;
47 for (int i = 0; i < 10; i++) {
48 data[i] = i;
49 }
50 }
51 return TinyNN_SUCCESS;
52}
53
54TinyNNStatus Init1(
55 Tensor** inputs, int nr_input, Tensor* out_weights, int* nr_out_weight,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected