Fork me on GitHub
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood

exporting

Procs

proc toRawSeq[T](t: Tensor[T]): seq[T] {...}{.noSideEffect.}
Convert a tensor to the raw sequence of data.   Source Edit
proc export_tensor[T](t: Tensor[T]): tuple[shape: seq[int], strides: seq[int],
                                        data: seq[T]] {...}{.noSideEffect.}
Export the tensor as a tuple containing
  • shape
  • strides
  • data

If the tensor was not contiguous (a slice for example), it is reshaped. Data is exported in C order (last index changes the fastest, column in 2D case)

  Source Edit
proc toSeq2D[T](t: Tensor[T]): seq[seq[T]]
Exports a rank-2 tensor to a 2D sequence.   Source Edit
proc toSeq3D[T](t: Tensor[T]): seq[seq[seq[T]]]
Exports a rank-3 tensor to a 3D sequence.   Source Edit
proc toSeq4D[T](t: Tensor[T]): seq[seq[seq[seq[T]]]]
Exports a rank-4 tensor to a 4D sequence.   Source Edit
proc toSeq5D[T](t: Tensor[T]): seq[seq[seq[seq[seq[T]]]]]
Exports a rank-5 tensor to a 5D sequence.   Source Edit