Skip to content

Commit

Permalink
fixed a bug in reshape modification (was returning unintialized tenso…
Browse files Browse the repository at this point in the history
…r when copying)
  • Loading branch information
darkestpigeon committed Jul 11, 2024
1 parent d486689 commit 70c011c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/arraymancer/tensor/private/p_shapeshifting.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ proc reshape_no_copy*(t: AnyTensor, new_shape: varargs[int]|Metadata|seq[int], r
result.offset = t.offset

proc reshape_with_copy*[T](t: Tensor[T], new_shape: varargs[int]|Metadata|seq[int], result: var Tensor[T]) =
var cont: Tensor[T]
contiguousImpl(t, rowMajor, cont)
reshape_no_copy(cont, new_shape, result, rowMajor)
contiguousImpl(t, rowMajor, result)
reshape_no_copy(t, new_shape, result, rowMajor)

proc infer_shape*(t: Tensor, new_shape: varargs[int]): seq[int] {.noinit.} =
## Replace the single -1 value on `new_shape` with the value that
Expand Down

0 comments on commit 70c011c

Please sign in to comment.