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

Method Forward

src/model/layer/slice.cc:56–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56const vector<Tensor> Slice::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 CHECK_EQ(inputs.size(), 1u) << "Split layer only have one input tensor.";
60 size_t offset = 0;
61 for (auto& s : slice_point_) {
62 outputs.push_back(SliceOn(inputs.at(0), offset, s, axis_));
63 offset = s;
64 }
65 outputs.push_back(SliceOn(inputs.at(0), offset, inputs.at(0).shape(axis_),
66 axis_));
67 return outputs;
68}
69
70const std::pair<vector<Tensor>, vector<Tensor>> Slice::Backward(
71 int flag, const vector<Tensor>& grads) {

Callers

nothing calls this directly

Calls 3

SliceOnFunction · 0.85
shapeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected