| 26 | namespace TEngine { |
| 27 | |
| 28 | bool 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 | |
| 49 | void Flatten::SetSchema(void) |
| 50 | { |
nothing calls this directly
no test coverage detected