tensor

fun tensor(ctx: ExecutionContext, shape: IntArray, dtype: DType, data: FloatArray): Tensor<*, *>(source)

Creates a tensor from a float array with the given shape and dtype.

Return

A new tensor containing the provided data.

Parameters

ctx

The execution context.

shape

The tensor dimensions (e.g., 2, 3 for a 2x3 matrix).

dtype

The data type (use DType.fp32(), DType.int32(), etc.).

data

The float data to populate the tensor.