IReadOnlyTensor<TSelf,T>.ToDenseTensor Method

Definition

Creates a dense tensor from the elements of the current tensor.

public:
 TSelf ToDenseTensor();
public TSelf ToDenseTensor();
abstract member ToDenseTensor : unit -> 'Self
Public Function ToDenseTensor () As TSelf

Returns

TSelf

The current tensor if it is already dense; otherwise, a new tensor that contains the elements of this tensor.

Remarks

A dense tensor is one where the elements are ordered sequentially in memory and where no gaps exist between the elements.

For a 2x2 Tensor, this would mean it has FlattendLength: 4; Lengths: [2, 2]; Strides: [4, 1]. The elements would be sequentially accessed via indexes: [0, 0]; [0, 1]; [1, 0]; [1, 1]

Applies to