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

Method Forward

src/model/layer/concat.cc:56–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56const vector<Tensor> Concat::Forward(int flag, const vector<Tensor>& inputs) {
57 // TODO(wangwei) check the inputs shape to be the same for all iterations
58 vector<Tensor> outputs;
59 slice_point_.clear();
60 size_t offset = 0;
61 for (auto& x : inputs) {
62 offset += x.shape(axis_);
63 slice_point_.push_back(offset);
64 }
65 if (inputs.size() == 1u) {
66 outputs = inputs;
67 } else {
68 outputs.push_back(ConcatOn(inputs, axis_));
69 }
70 return outputs;
71}
72
73const std::pair<vector<Tensor>, vector<Tensor>> Concat::Backward(
74 int flag, const vector<Tensor>& grads) {

Callers

nothing calls this directly

Calls 3

ConcatOnFunction · 0.85
shapeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected