szha commented on a change in pull request #10025: Language model with Google's 
billion words dataset
URL: https://github.com/apache/incubator-mxnet/pull/10025#discussion_r173681036
 
 

 ##########
 File path: src/operator/nn/fully_connected-inl.h
 ##########
 @@ -95,11 +95,16 @@ void FCForward(const OpContext &ctx, const 
FullyConnectedParam &param,
         Shape2(oshape[0], oshape.ProdShape(1, oshape.ndim())), s);
   }
 
+  CHECK_EQ(data.shape_[1], wmat.shape_[1])
+    << "weight.data().shape[1] != data.data().shape[1]. Not supported by 
FCForward";
   // Legacy approach shown here for comparison:
   //   out = dot(data, wmat.T());
   linalg_gemm(data, wmat, out, false, true, s);
   if (!param.no_bias) {
-    Tensor<xpu, 1, DType> bias = in_data[fullc::kBias].get<xpu, 1, DType>(s);
+    Tensor<xpu, 1, DType> bias = in_data[fullc::kBias].get_with_shape<xpu, 1, 
DType>(
+      Shape1(wmat.shape_[0]), s);
+    CHECK_EQ(bias.shape_[0], wmat.shape_[0])
+      << "bias.data().shape[0] != weight.data().shape[0]. Not supported by 
FCForward";
 
 Review comment:
   Use words to describe the error instead. Also, if `flatten is True` the 
error message for `data.data()` might not make sense.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to