Matrix to tensor🔗

Converts a matrix to a tensor. This tool is a special case of reshape tensor that takes a two-dimensional matrix as input.

Inputs🔗

  • matrix: The input matrix.

  • shape: The shape of the output tensor. A 1-by-N matrix, where N is the number of dimensions in the output tensor. At most one component of the shape can be non-positive (<= 0), which causes the size of that dimension to be computed so that all elements of the input tensor are consumed. If the shape is empty, it will be treated as if it contained {matrix rows, matrix columns}, producing a two-dimensional tensor.

Outputs🔗

  • tensor: The output tensor. The data type of the output tensor will be same as that of the input matrix.