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

Method InferShape

operator/operator/clip.cpp:28–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace TEngine {
27
28bool Clip::InferShape(const std::vector<TEngine::TShape>& ishape, std::vector<TEngine::TShape>& oshape, int layout)
29{
30 const TShape& input_shape = ishape[0];
31 int input_h = input_shape.GetH();
32 int input_w = input_shape.GetW();
33
34 int output_h = input_h;
35 int output_w = input_w;
36
37 TShape shape;
38 if(layout == TENGINE_LAYOUT_NCHW)
39 {
40 std::vector<int> dim = {input_shape.GetN(), input_shape.GetC(), output_h, output_w};
41
42 shape.SetDim(dim);
43 shape.SetDataLayout(TENGINE_LAYOUT_NCHW);
44 }
45 else
46 {
47 std::vector<int> dim = {input_shape.GetN(), output_h, output_w, input_shape.GetC()};
48
49 shape.SetDim(dim);
50 shape.SetDataLayout(TENGINE_LAYOUT_NHWC);
51 }
52 oshape[0] = shape;
53
54 return true;
55}
56void Clip::SetSchema(void)
57{
58 Input({"input:float"}).Output({"output:float"}).SetAttr("max", 0).SetAttr("min", 0).SetDoc(R"DOC(Clip Layer)DOC");

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