haojin2 commented on a change in pull request #15314: [Numpy] Numpy dstack
URL: https://github.com/apache/incubator-mxnet/pull/15314#discussion_r302816983
##########
File path: src/operator/nn/concat-inl.h
##########
@@ -141,6 +141,37 @@ void ConcatCompute(const nnvm::NodeAttrs& attrs, const
OpContext& ctx,
});
}
+template<typename xpu>
+void DStackCompute(const nnvm::NodeAttrs& attrs, const OpContext& ctx,
+ const std::vector<TBlob>& inputs,
+ const std::vector<OpReqType>& req,
+ const std::vector<TBlob>& outputs) {
+ ConcatParam param = nnvm::get<ConcatParam>(attrs.parsed);
+ param.dim = 2;
+ std::vector<TBlob> modified_inputs(inputs.size());
+ for (int i = 0; i < param.num_args; ++i) {
+ if (inputs[i].shape_.ndim() == 0) {
+ modified_inputs[i] = inputs[i].reshape(TShape(3, 1));
+ } else if (inputs[i].shape_.ndim() == 1) {
+ TShape t = TShape(3, 1);
+ t[1] = inputs[i].shape_[0];
+ modified_inputs[i] = inputs[i].reshape(t);
+ } else if (inputs[i].shape_.ndim() == 2) {
+ TShape t = TShape(3, 1);
Review comment:
`TShape t = TShape(3, 1);`
one space between operators and operands, same for all applicable places.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services