Skip to content

Commit 3b9b2c6

Browse files
manuelcandalesfacebook-github-bot
authored andcommitted
Fix op constant_pad_nd (#708)
Summary: Pull Request resolved: #708 Fix for zero rank tensor ghstack-source-id: 203341585 exported-using-ghexport Reviewed By: SS-JIA Differential Revision: D49849625 fbshipit-source-id: 4b01ed70f03a1552047e11849482aa035bde80d5
1 parent b98d6a7 commit 3b9b2c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernels/portable/cpu/op_constant_pad_nd.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ void constant_pad_nd_out_impl(
145145

146146
size_t ndim = self.dim();
147147

148+
if (ndim == 0) {
149+
out_data[0] = self_data[0];
150+
return;
151+
}
152+
148153
int64_t self_sizes[kTensorDimensionLimit];
149154
int64_t self_strides[kTensorDimensionLimit];
150155
int64_t out_sizes[kTensorDimensionLimit];

0 commit comments

Comments
 (0)