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

Method InferShape

operator/operator/bias.cpp:5–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3namespace TEngine{
4
5bool Bias::InferShape(const std::vector<TEngine::TShape>& ishape, std::vector<TEngine::TShape>& oshape, int layout)
6{
7 const TShape& input_shape = ishape[0];
8 int input_h = input_shape.GetH();
9 int input_w = input_shape.GetW();
10
11 int output_h = input_h;
12 int output_w = input_w;
13
14 TShape shape;
15 if(layout == TENGINE_LAYOUT_NCHW)
16 {
17 std::vector<int> dim = {input_shape.GetN(), input_shape.GetC(), output_h, output_w};
18
19 shape.SetDim(dim);
20 shape.SetDataLayout(TENGINE_LAYOUT_NCHW);
21 }
22 else
23 {
24 std::vector<int> dim = {input_shape.GetN(), output_h, output_w, input_shape.GetC()};
25
26 shape.SetDim(dim);
27 shape.SetDataLayout(TENGINE_LAYOUT_NHWC);
28 }
29 oshape[0] = shape;
30
31 return true;
32}
33
34void Bias::SetSchema(void)
35{

Callers

nothing calls this directly

Calls 6

GetHMethod · 0.80
GetWMethod · 0.80
GetNMethod · 0.80
GetCMethod · 0.80
SetDimMethod · 0.80
SetDataLayoutMethod · 0.80

Tested by

no test coverage detected