module Bottle::Assemble
Extended Modules
Direct including types
Defined in:
arrayops/build.crInstance Method Summary
- #column_stack(alist : Array(BaseArray(U))) forall U
-
#concatenate(alist : Array(BaseArray(U)), axis : Int32) forall U
Concatenates an array of
Tensor's
along a provided axis. - #dstack(alist : Array(BaseArray(U))) forall U
-
#hstack(alist : Array(BaseArray(U))) forall U
Concatenates a list of
Tensor
s along axis 1 -
#vstack(alist : Array(BaseArray(U))) forall U
Concatenates a list of
Tensor
s along axis 0
Instance Method Detail
Concatenates an array of Tensor's
along a provided axis.
Parameters
alist : Array(Tensor)
- Array containing Tensors to be concatenated axis : Int32
- Axis for concatentation, must be an existing axis present in all Tensors, and all Tensors must have the same shape off-axis
Returns
ret : Tensor
- Result of the concatenation
Examples
t = Tensor.new([2, 2, 3]) { |i| i }
concatenate([t, t, t], axis=-1)
Tensor([[[ 0, 1, 2, 0, 1, 2, 0, 1, 2],
[ 3, 4, 5, 3, 4, 5, 3, 4, 5]],
[[ 6, 7, 8, 6, 7, 8, 6, 7, 8],
[ 9, 10, 11, 9, 10, 11, 9, 10, 11]]])
Concatenates a list of Tensor
s along axis 1
Parameters
alist : Array(Tensor)
- Array containing Tensors to be stacked
Returns
ret : Tensor
- Result of the concatenation
Examples
t = Tensor.new([2, 2, 3])
hstack([t, t, t])
Tensor([[[ 0, 1, 2],
[ 3, 4, 5],
[ 0, 1, 2],
[ 3, 4, 5],
[ 0, 1, 2],
[ 3, 4, 5]],
[[ 6, 7, 8],
[ 9, 10, 11],
[ 6, 7, 8],
[ 9, 10, 11],
[ 6, 7, 8],
[ 9, 10, 11]]])
Concatenates a list of Tensor
s along axis 0
Parameters
alist : Array(Tensor)
- Array containing Tensors to be stacked
Returns
ret : Tensor
- Result of the concatenation
Examples
t = Tensor.new([2, 2, 3])
vstack([t, t, t])
Tensor([[[ 0, 1, 2],
[ 3, 4, 5]],
[[ 6, 7, 8],
[ 9, 10, 11]],
[[ 0, 1, 2],
[ 3, 4, 5]],
[[ 6, 7, 8],
[ 9, 10, 11]],
[[ 0, 1, 2],
[ 3, 4, 5]],
[[ 6, 7, 8],
[ 9, 10, 11]]])