Skip to content

Commit 62f8a8e

Browse files
authored
Allow zero-element inputs for method.
Differential Revision: D80881025 Pull Request resolved: #13623
1 parent c3cf646 commit 62f8a8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

runtime/core/exec_aten/util/tensor_util_portable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ Error copy_tensor_data(
161161
const torch::executor::Tensor& t_dst,
162162
const torch::executor::Tensor& t_src) {
163163
ET_CHECK_OR_RETURN_ERROR(
164-
t_dst.const_data_ptr() != nullptr,
164+
t_dst.const_data_ptr() != nullptr ||
165+
(t_dst.nbytes() == 0 && t_src.nbytes() == 0),
165166
InvalidArgument,
166167
"ExecutionPlan input supposed to preallocated but has nullptr for data");
167168
// inputs with a size 0 dimension can be nullptr

0 commit comments

Comments
 (0)