JohnCalhoun closed pull request #12818: [MXNET-1094] Add tests to check 
operators for registered FGradients
URL: https://github.com/apache/incubator-mxnet/pull/12818
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/cpp/operator/runner/core_op_runner_test.cc 
b/tests/cpp/operator/runner/core_op_runner_test.cc
index 6cc2baddae2..1e3c830dcc2 100644
--- a/tests/cpp/operator/runner/core_op_runner_test.cc
+++ b/tests/cpp/operator/runner/core_op_runner_test.cc
@@ -54,6 +54,27 @@ inline std::vector<TT> AsVect(const TT& t) {
   return std::move(std::vector<TT>({ t }));
 }
 
+/*!
+ * \brief Scan operators and check for registered FGradient
+ */
+TEST(CORE_OP_RUNNER, ScanOperatorsForFGradients) {
+    std::vector<std::string> names = dmlc::Registry<Op>::ListAllNames();
+    std::cout << "total ops: " << names.size() << "\n";
+    std::vector<std::string> opsWithOutGradient;
+    std::stringstream ss;
+    ss << "The Following ops do not have an FGradient registered: ";
+
+    for (std::vector<std::string>::iterator i = names.begin(); i != 
names.end(); ++i) {
+        const Op* op = dmlc::Registry<Op>::Find(*i);
+        auto gradient = op->GetAttr<nnvm::FGradient>("FGradient");
+        if (gradient.count(op) == 0) {
+            ss << op->name << ", ";
+            opsWithOutGradient.push_back(op->name);
+        }
+    }
+    ASSERT_TRUE(opsWithOutGradient.size() == 0) << ss.str();
+}
+
 /*!
  * \brief Generic bidirectional sanity test for simple unary op
  */


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to