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

Method InferShape

operator/operator/l2pool.cpp:28–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace TEngine {
27
28bool L2Pool::InferShape(const std::vector<TEngine::TShape>& ishape, std::vector<TEngine::TShape>& oshape,
29 int layout)
30{
31 const TShape& input_shape = ishape[0];
32
33 int input_h = input_shape.GetH();
34 int input_w = input_shape.GetW();
35 int output_h = 0;
36 int output_w = 0;
37
38 if(param_.padding == PaddingType::kSame)
39 {
40 output_h = (input_h + param_.stride_h - 1) / param_.stride_h;
41 output_w = (input_w + param_.stride_w - 1) / param_.stride_w;
42 }
43 else
44 {
45 output_h = (input_h + param_.stride_h - param_.kernel_h) / param_.stride_h;
46 output_w = (input_w + param_.stride_w - param_.kernel_w) / param_.stride_w;
47 }
48
49 TShape shape;
50 std::vector<int> dim = {input_shape.GetN(), output_h, output_w, input_shape.GetC()};
51 shape.SetDim(dim);
52 shape.SetDataLayout(TENGINE_LAYOUT_NHWC);
53
54 oshape[0] = shape;
55 return true;
56}
57
58float L2Pool::GetFops(const std::vector<TShape>& inputs, const std::vector<TShape>& outputs)
59{

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