Skip to content

Commit 314d95a

Browse files
jerryzh168facebook-github-bot
authored andcommitted
Renaming dims() to sizes() (caffe2/caffe2) - 3/4 (pytorch#13096)
Summary: Pull Request resolved: pytorch#13096 Codemod generated with clangr shard mode, 25 files per diff, for renaming dims() to sizes() Reviewed By: ezyang Differential Revision: D10842875 fbshipit-source-id: 1784859735ed4d1bd5ccd7ca56e289498374a68f
1 parent 557db18 commit 314d95a

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

caffe2/ideep/operators/concat_split_op.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class IDEEPConcatOp final : public IDEEPOperator {
3737
BlobIsTensorType(OperatorBase::InputBlob(i), CPU),
3838
"Expect cpu tensor if not itensor");
3939
auto& tensor_cpu = OperatorBase::Input<Tensor>(i, CPU);
40-
CAFFE_ENFORCE(tensor_cpu.dims().size() == 0 ||
41-
tensor_cpu.numel() == 0,
42-
"Expect zero dim tensor");
40+
CAFFE_ENFORCE(
41+
tensor_cpu.sizes().size() == 0 || tensor_cpu.numel() == 0,
42+
"Expect zero dim tensor");
4343
}
4444
}
4545

caffe2/ideep/operators/utility_ops.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CopyCPUToIDEEPOp final : public IDEEPOperator {
1212
bool RunOnDevice() override {
1313
const auto& X = OperatorBase::Input<Tensor>(0, CPU);
1414
auto* Y = OperatorBase::OutputBlob(0);
15-
itensor::dims src_dims(X.dims().begin(), X.dims().end());
15+
itensor::dims src_dims(X.sizes().begin(), X.sizes().end());
1616
if (!(Y->template IsType<itensor>() &&
1717
Y->Get<itensor>().get_data_type() == itensor::data_type::f32) ||
1818
Y->Get<itensor>().get_dims() != src_dims) {

caffe2/mpi/mpi_ops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class MPIAllgatherOp final : public Operator<Context> {
9898
MPI_Comm comm = OperatorBase::Input<MPICommonWorldWrapper>(0).comm();
9999
auto& input = Input(1);
100100
auto* output = Output(0);
101-
vector<int64_t> output_dims = input.dims().vec();
101+
vector<int64_t> output_dims = input.sizes().vec();
102102
output_dims[0] *= OperatorBase::Input<MPICommonWorldWrapper>(0).size();
103103
output->Resize(output_dims);
104104
MPI_CHECK(MPI_Allgather(

caffe2/predictor/predictor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void exportOutputTensor(
3434
const std::string& name,
3535
TensorCPU& output) {
3636
auto tensor = getTensor(ws, name);
37-
output.Resize(tensor->dims());
37+
output.Resize(tensor->sizes());
3838
output.ShareData(*tensor);
3939
}
4040

caffe2/predictor/predictor_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ TEST_F(PredictorTest, SimpleBatchSized) {
186186
Predictor::TensorList output;
187187
(*p_)(input, &output);
188188
EXPECT_EQ(output.size(), 1);
189-
EXPECT_EQ(output.front().dims().size(), 2);
189+
EXPECT_EQ(output.front().sizes().size(), 2);
190190
EXPECT_EQ(output.front().dim(0), 1);
191191
EXPECT_EQ(output.front().dim(1), 10);
192192
EXPECT_NEAR(output.front().data<float>()[4], 0.1209, 1E-4);
@@ -203,7 +203,7 @@ TEST_F(PredictorTest, SimpleBatchSizedMapInput) {
203203
Predictor::TensorList output;
204204
(*p_)(input, &output);
205205
EXPECT_EQ(output.size(), 1);
206-
EXPECT_EQ(output.front().dims().size(), 2);
206+
EXPECT_EQ(output.front().sizes().size(), 2);
207207
EXPECT_EQ(output.front().dim(0), 1);
208208
EXPECT_EQ(output.front().dim(1), 10);
209209
EXPECT_NEAR(output.front().data<float>()[4], 0.1209, 1E-4);

caffe2/python/pybind_state.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void addObjectMethods(py::module& m) {
402402
// be, since we're doing an extra allocation we didn't
403403
// need to do. But I don't remember how to clue in
404404
// pybind11 how to convert ArrayRef to vector.
405-
return tensor->dims().vec();
405+
return tensor->sizes().vec();
406406
})
407407
.def(
408408
"_reshape",

0 commit comments

Comments
 (0)