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

Method Backward

src/model/layer/concat.cc:73–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73const std::pair<vector<Tensor>, vector<Tensor>> Concat::Backward(
74 int flag, const vector<Tensor>& grads) {
75 vector<Tensor> input_grad, param_grad;
76 CHECK_EQ(grads.size(), 1u) << "Concat layer only have one output tensor.";
77 size_t last_offset = 0u;
78 for (auto p : slice_point_) {
79 input_grad.push_back(SliceOn(grads.at(0), last_offset, p, axis_));
80 last_offset = p;
81 }
82 return std::make_pair(input_grad, param_grad);
83}
84
85} // namespace singa

Callers

nothing calls this directly

Calls 2

SliceOnFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected