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


Group by:


proc broadcast2[T](a, b: ClTensor[T]): tuple[a, b: ClTensor[T]] {...}{.noSideEffect, noInit.}

Broadcast 2 tensors so they have compatible shapes for element-wise computations.

Tensors in the tuple can be accessed with output.a and output.b

The returned broadcasted Tensors share the underlying data with the input.

Dimension(s) of size 1 can be expanded to arbitrary size by replicating values along that dimension.

Warning ⚠:
This is a no-copy operation, data is shared with the input. This proc does not guarantee that a let value is immutable. A broadcasted tensor should not be modified and only used for computation.
  Source Edit