apeforest commented on a change in pull request #14779: [WIP] Fully connected,
higher order grad
URL: https://github.com/apache/incubator-mxnet/pull/14779#discussion_r305545329
##########
File path: src/operator/nn/fully_connected.cc
##########
@@ -176,11 +176,23 @@ struct FullyConnectedGrad {
}
};
-inline static bool FCStorageType(const nnvm::NodeAttrs& attrs,
- const int dev_mask,
- DispatchMode* dispatch_mode,
- std::vector<int> *in_attrs,
- std::vector<int> *out_attrs) {
+
+struct FullyConnectedGradGrad {
+ const char *op_name;
+ std::vector<nnvm::NodeEntry> operator()(const nnvm::NodePtr& n,
+ const std::vector<nnvm::NodeEntry>&
ograds) const {
+ std::vector<nnvm::NodeEntry> heads(ograds.begin(), ograds.end());
+ heads.push_back(n->inputs[0]); // o_y : head gradient of the output y
+ return MakeGradNode(op_name, n, heads, n->attrs.dict);
+ }
+};
+
+
+static bool FCStorageType(const nnvm::NodeAttrs& attrs,
Review comment:
Why remove inline?
----------------------------------------------------------------
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