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

Method InferShape

operator/operator/resize.cpp:27–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26namespace TEngine {
27bool Resize::InferShape(const std::vector<TEngine::TShape>& ishape, std::vector<TEngine::TShape>& oshape, int layout)
28{
29 const TShape& input = ishape[0];
30
31 int out_h = ( int )(input.GetH() * param_.scale_h);
32 int out_w = ( int )(input.GetW() * param_.scale_w);
33
34 TShape shape;
35 if(layout == TENGINE_LAYOUT_NHWC)
36 {
37 std::vector<int> dim = {input.GetN(), out_h, out_w, input.GetC()};
38 shape.SetDim(dim);
39 shape.SetDataLayout(TENGINE_LAYOUT_NHWC);
40 }
41 else
42 {
43 std::vector<int> dim = {input.GetN(), input.GetC(), out_h, out_w};
44 shape.SetDim(dim);
45 shape.SetDataLayout(TENGINE_LAYOUT_NCHW);
46 }
47 oshape[0] = shape;
48
49 return true;
50}
51
52void Resize::SetSchema(void)
53{

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