Fork me on GitHub

src/arraymancer/autograd/gates_shapeshifting_concat_split

  Source Edit

Types

ChunkSplitGate[TT] {.final.} = ref object of Gate[TT]
  Source Edit

Procs

proc chunk[TT](v: Variable[TT]; nb_chunks: Positive; axis: Natural): seq[
    Variable[TT]]

Splits a Variable into n chunks along the specified axis.

In case a tensor cannot be split evenly, with la == length_axis, n = n_chunks it returns la mod n subtensors of size (la div n) + 1 the rest of size la div n. So split sizes at most differs by 1

This is consistent with numpy array_split

  Source Edit
proc stack[TT](variables: varargs[Variable[TT]]; axis = 0): Variable[TT]

Join a sequence of Variables along a new axis into a new Variable. All variables must be of the same shape

Input:

  • a variable
  • an axis (dimension)

Returns:

  • a new stacked variable along the new axis
  Source Edit
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood