MCPcopy Create free account
hub / github.com/OAID/Tengine / Run

Method Run

executor/operator/ref/ref_logical.cpp:51–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51bool LogicalOps::Run(Node* node)
52{
53 Logical* logical_op = dynamic_cast<Logical*>(node->GetOp());
54 LogicalParam* param = logical_op->GetParam();
55 Tensor* input_tensor0 = node->GetInputTensor(0);
56 const TShape& ishape = input_tensor0->GetShape();
57 void* input0 = get_tensor_mem(input_tensor0);
58 Tensor* input_tensor1 = nullptr;
59 void* input1 = nullptr;
60
61 // int x = node->GetInputNum();
62 // printf("inputnum:%d\n", x);
63 // this version only support for input_num=2
64 // int input_number=node->GetInputNum();
65
66 // output
67 Tensor* output_tensor = node->GetOutputTensor(0);
68 // if(input_tensor0->GetDataType() == TENGINE_DT_INT8 || input_tensor0->GetDataType() == TENGINE_DT_UINT8)
69 // {
70 // if(get_scale_zero(input_tensor0, output_tensor, &op_param) < 0)
71 // return false;
72 // }
73
74 if(node->GetInputNum() > 1)
75 {
76 input_tensor1 = node->GetInputTensor(1);
77 // printf("input_tensor1 %p\n", input_tensor1);
78 const TShape& ishape1 = input_tensor1->GetShape();
79 input1 = get_tensor_mem(input_tensor1);
80 op_param.shape1[0] = ishape1.GetN();
81 op_param.shape1[1] = ishape1.GetC();
82 op_param.shape1[2] = ishape1.GetH();
83 op_param.shape1[3] = ishape1.GetW();
84
85 // if(input_tensor1->GetDataType() == TENGINE_DT_INT8 || input_tensor1->GetDataType() == TENGINE_DT_UINT8)
86 // {
87 // if(get_scale_zero_1(input_tensor1, &op_param) < 0)
88 // return false;
89 // }
90 }
91 void* output = get_tensor_mem(output_tensor);
92 op_param.shape0[0] = ishape.GetN();
93 op_param.shape0[1] = ishape.GetC();
94 op_param.shape0[2] = ishape.GetH();
95 op_param.shape0[3] = ishape.GetW();
96 op_param.type = param->type;
97
98 int ret = kernel_run(input0, input1, output, &op_param);
99
100 // if(input_tensor0->GetDataType() == TENGINE_DT_INT8)
101 // {
102 // auto* o_quant = output_tensor->GetQuantParam();
103 // QuantParam q_param;
104 // q_param.scale = op_param.scale[2];
105 // o_quant->resize(0);
106 // o_quant->push_back(q_param);
107 // }
108

Callers

nothing calls this directly

Calls 11

get_tensor_memFunction · 0.85
kernel_runFunction · 0.85
GetOpMethod · 0.80
GetParamMethod · 0.80
GetNMethod · 0.80
GetCMethod · 0.80
GetHMethod · 0.80
GetWMethod · 0.80
GetInputTensorMethod · 0.45
GetOutputTensorMethod · 0.45
GetInputNumMethod · 0.45

Tested by

no test coverage detected