matrix reshape for filters
Change the dimensions of a matrix.
Signature
> matrix reshape {flags} (dimensions) ...rest
Flags
--flatten, -f: Flatten the matrix to a 1D vector
Parameters
dimensions: The new dimensions (e.g., 2 3 for a 2x3 matrix). Required unless --flatten is used....rest: Additional dimensions for n-dimensional reshaping.
Input/output types:
| input | output |
|---|---|
| matrix | matrix |
Examples
Reshape a 1x6 matrix to 2x3
> [[1 2 3 4 5 6]] | into matrix | matrix reshape 2 3 | matrix into-nu | to nuon
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]Flatten a 2x2 matrix to 1D
> matrix identity 2 | matrix reshape --flatten | matrix into-nu | to nuon
[[1.0, 0.0, 0.0, 1.0]]