Skip to content

Commit c44d005

Browse files
Small tweaks to copy_numpy_ndarray_into_usm_ndarray validation code
1 parent 49b9342 commit c44d005

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dpctl/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void copy_numpy_ndarray_into_usm_ndarray(
8484
const py::ssize_t *dst_shape = dst.get_shape_raw();
8585
bool shapes_equal(true);
8686
size_t src_nelems(1);
87-
for (int i = 0; i < src_ndim; ++i) {
87+
for (int i = 0; shapes_equal && (i < src_ndim); ++i) {
8888
shapes_equal = shapes_equal && (src_shape[i] == dst_shape[i]);
8989
src_nelems *= static_cast<size_t>(src_shape[i]);
9090
}
@@ -114,7 +114,7 @@ void copy_numpy_ndarray_into_usm_ndarray(
114114
py::detail::array_descriptor_proxy(npy_src.dtype().ptr())->type_num;
115115
int dst_typenum = dst.get_typenum();
116116

117-
auto array_types = td_ns::usm_ndarray_types();
117+
const auto &array_types = td_ns::usm_ndarray_types();
118118
int src_type_id = array_types.typenum_to_lookup_id(src_typenum);
119119
int dst_type_id = array_types.typenum_to_lookup_id(dst_typenum);
120120

0 commit comments

Comments
 (0)