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

Method InferShape

operator/operator/flatten.cpp:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace TEngine {
27
28bool Flatten::InferShape(const std::vector<TEngine::TShape>& ishape, std::vector<TEngine::TShape>& oshape, int layout)
29{
30 const TShape& input = ishape[0];
31
32 const std::vector<int>& in_dim = input.GetDim();
33 int in_size = in_dim.size();
34
35 int new_channel = 1;
36 for(int i = param_.axis; i <= param_.end_axis && i < in_size; i++)
37 {
38 new_channel *= in_dim[i];
39 }
40
41 TShape shape;
42 std::vector<int> dim = {in_dim[0], new_channel, 1, 1};
43 shape.SetDim(dim);
44 shape.SetDataLayout(input.GetDataLayout());
45 oshape[0] = shape;
46 return true;
47}
48
49void Flatten::SetSchema(void)
50{

Callers

nothing calls this directly

Calls 4

SetDimMethod · 0.80
SetDataLayoutMethod · 0.80
GetDataLayoutMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected