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

Function PrepareOneTensor

executor/lib/custom_kernel.cpp:12–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace CustomKernelManager {
11
12static void PrepareOneTensor(Node* node, Tensor* tensor, struct custom_kernel_tensor* t)
13{
14 const TShape& shape = tensor->GetShape();
15 const std::vector<int>& dims = shape.GetDim();
16
17 const ExecAttr* exec_attr = any_cast<const ExecAttr*>(node->GetAttr(ATTR_EXEC_ATTR));
18
19 t->dim_num = dims.size();
20
21 for(int i = 0; i < t->dim_num; i++)
22 {
23 t->dim[i] = dims[i];
24 }
25
26 t->data_type = tensor->GetDataType();
27 t->element_num = shape.GetSize();
28 t->element_size = DataType::GetTypeSize(t->data_type);
29 t->layout_type = exec_attr->graph_layout;
30
31 t->data = nullptr;
32}
33
34bool PrepareTensors(Node* node, struct custom_kernel_tensor**& k_inputs, int input_num,
35 struct custom_kernel_tensor**& k_outputs, int output_num)

Callers 1

PrepareTensorsFunction · 0.85

Calls 5

GetDataTypeMethod · 0.80
GetTypeSizeFunction · 0.50
GetAttrMethod · 0.45
sizeMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected