Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion aten/src/ATen/native/Indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Tensor & _index_put_impl_(Tensor & self, TensorList indices, const Tensor & valu
if (accumulate && self.type().device_type() == kCUDA) {
index_put_accum_stub(self.type().device_type(), self, indices, value, unsafe);
return self;
}
}
auto info = make_info(self, indices);
auto iter = make_index_put_iterator(info, value);
index_put_stub(iter->device_type(), *iter, info.indexed_sizes, info.indexed_strides, accumulate);
Expand All @@ -272,7 +272,11 @@ Tensor & index_copy_(Tensor & self, int64_t dim, const Tensor & index, const Ten
int64_t numIndices = index.numel();
if (source.dim() == 0 && numIndices != 1) {
AT_INDEX_ERROR("index_copy_(): When source is scalar, index should have one element (got ", numIndices, ")");
} else if ((source.dim() != self.dim()) && (source.dim() != 0 && self.dim() != 0)) {
AT_INDEX_ERROR("index_copy_(): When source and destination are not scalars, their dimensionality must match. Source dimensionality (",
source.dim(), "), destination dimensionality (", self.dim(), ")");
}

if (index.scalar_type() != ScalarType::Long) {
AT_INDEX_ERROR("index_copy_(): Expected LongTensor for index");
}
Expand Down