diff --git a/src/arraymancer/private/sequninit.nim b/src/arraymancer/private/sequninit.nim index 3fd579a2..8b6daf0d 100644 --- a/src/arraymancer/private/sequninit.nim +++ b/src/arraymancer/private/sequninit.nim @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# from Nim https://github.com/nim-lang/Nim/pull/22739 on the stdlib provides a +# `newSeqUninit` for types supporting `supportsCopyMem` when not declared(newSeqUninit): - # https://github.com/nim-lang/Nim/pull/22586#issuecomment-1698160304 - func newSeqUninit*[T](len: Natural): seq[T] {.inline.} = ## Creates an uninitialzed seq. ## Contrary to newSequnitialized in system.nim this works for any subtype T diff --git a/src/arraymancer/tensor/exporting.nim b/src/arraymancer/tensor/exporting.nim index 51fef8d9..513679de 100644 --- a/src/arraymancer/tensor/exporting.nim +++ b/src/arraymancer/tensor/exporting.nim @@ -37,7 +37,7 @@ proc toRawSeq*[T](t:Tensor[T]): seq[T] {.noSideEffect, deprecated: "This proc ca # Due to forward declaration this proc must be declared # after "cpu" proc are declared in init_cuda when t is Tensor: - result = newSeqUninit[T](t.size) + result = newSeq[T](t.size) for i in 0 ..< t.size: when T is KnownSupportsCopyMem: result[i] = t.unsafe_raw_offset()[i]