MCPcopy Create free account
hub / github.com/apache/singa / Forward

Method Forward

src/model/layer/flatten.cc:37–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37const Tensor Flatten::Forward(int flag, const Tensor &input) {
38 Tensor output;
39 input_shape_ = input.shape();
40 if (axis_ == 0)
41 output = Reshape(input, vector<size_t>{input.Size()});
42 else
43 output =
44 Reshape(input, vector<size_t>{input.Size() / out_sample_shape_.at(0),
45 out_sample_shape_.at(0)});
46 return output;
47}
48
49const std::pair<Tensor, vector<Tensor> > Flatten::Backward(int flag,
50 const Tensor &grad) {

Callers

nothing calls this directly

Calls 3

shapeMethod · 0.80
ReshapeFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected