Function from_array

Source
pub fn from_array<T: ElemType>(
    data: impl Into<Vec<T>> + Debug,
    shape: impl Shape,
    device: impl AsDevice,
) -> Tensor
Expand description

Creates a Tensor from an array of values.

§Arguments

  • data - The array of values.
  • shape - The shape of the Tensor.
  • device - The device to place the Tensor on.

§Returns

A Tensor created from the array of values.