mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 03:28:50 +00:00
Explicit error when slice-set is called with the same src and dst. (#2733)
This commit is contained in:
@ -248,6 +248,9 @@ impl Tensor {
|
||||
if !self.is_contiguous() || !src.is_contiguous() {
|
||||
Err(Error::RequiresContiguous { op: "slice-set" }.bt())?
|
||||
}
|
||||
if self.same_storage(src) {
|
||||
crate::bail!("cannot use slice_set when self and src share their storage")
|
||||
}
|
||||
if self.dtype() != src.dtype() {
|
||||
Err(Error::DTypeMismatchBinaryOp {
|
||||
lhs: self.dtype(),
|
||||
|
Reference in New Issue
Block a user