mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
add more logging messages to dimension checks of FCGradient (#9203)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/9203 Closes https://github.com/pytorch/pytorch/pull/9203 Added extra logging for FCGradient input dimension checks Reviewed By: yinghai Differential Revision: D8738549 fbshipit-source-id: d4f26572d86f3d44f40c9dca62d4f241ba15aead
This commit is contained in:
parent
c67ade26a7
commit
2b8aea3ada
1 changed files with 22 additions and 2 deletions
|
|
@ -184,8 +184,28 @@ class FullyConnectedGradientOp : public Operator<Context> {
|
|||
const auto canonical_axis_w = W.canonical_axis_index(axis_w_);
|
||||
const int N = TransposeWeight ? W.size_to_dim(canonical_axis_w)
|
||||
: W.size_from_dim(canonical_axis_w);
|
||||
CAFFE_ENFORCE(M * K == X.size());
|
||||
CAFFE_ENFORCE(K * N == W.size());
|
||||
|
||||
auto dimErrorString = [&]() {
|
||||
return MakeString(
|
||||
"Dimension mismatch: ",
|
||||
"X: ",
|
||||
X.dims(),
|
||||
", W: ",
|
||||
W.dims(),
|
||||
", dY: ",
|
||||
dY.dims(),
|
||||
", axis: ",
|
||||
axis_,
|
||||
", M: ",
|
||||
M,
|
||||
", N: ",
|
||||
N,
|
||||
", K: ",
|
||||
K);
|
||||
};
|
||||
|
||||
CAFFE_ENFORCE(M * K == X.size(), dimErrorString());
|
||||
CAFFE_ENFORCE(K * N == W.size(), dimErrorString());
|
||||
|
||||
auto* dW = Output(0);
|
||||
auto* db = Output(1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue