summaryrefslogtreecommitdiff
path: root/caffe2/experiments
diff options
context:
space:
mode:
authorEdward Yang <ezyang@fb.com>2018-10-18 18:03:19 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-10-18 18:06:37 -0700
commit99bc541b5be82be6588ee8eea518298b1723aa1b (patch)
treef7b90d90cc625c36541a4ce0c2a871000a292cdc /caffe2/experiments
parent89bf98ac4ce84178c4144419776076898b6fda13 (diff)
downloadpytorch-99bc541b5be82be6588ee8eea518298b1723aa1b.tar.gz
pytorch-99bc541b5be82be6588ee8eea518298b1723aa1b.tar.bz2
pytorch-99bc541b5be82be6588ee8eea518298b1723aa1b.zip
size_from_dim(0) is like numel() but worse. Don't do it. (#12729)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12729 This may have a dependency on D10380678 if size_from_dim(0) was required because numel() used to return -1 in some cases. This is no longer true. Reviewed By: li-roy, dzhulgakov Differential Revision: D10415069 fbshipit-source-id: 39f46f56249ecaf3533f62a0205b3a45d519d789
Diffstat (limited to 'caffe2/experiments')
-rw-r--r--caffe2/experiments/operators/tt_contraction_op.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/caffe2/experiments/operators/tt_contraction_op.h b/caffe2/experiments/operators/tt_contraction_op.h
index 7f42d1f68d..b72e87b25f 100644
--- a/caffe2/experiments/operators/tt_contraction_op.h
+++ b/caffe2/experiments/operators/tt_contraction_op.h
@@ -44,8 +44,8 @@ class TTContractionOp final : public Operator<Context> {
CAFFE_ENFORCE(A.ndim() == 2, A.ndim());
- int64_t A_size = A.size_from_dim(0);
- int64_t B_size = B.size_from_dim(0);
+ int64_t A_size = A.numel();
+ int64_t B_size = B.numel();
CAFFE_ENFORCE(
K_ * M_ == A_size,
@@ -106,7 +106,7 @@ class TTContractionGradientOp final : public Operator<Context> {
auto* dA = Output(0);
auto* dB = Output(1);
- int64_t G_size = G.size_from_dim(0);
+ int64_t G_size = G.numel();
int64_t D_ = G_size / (M_ * N_);
int64_t dB_size = D_ * K_ * N_;