Share via


Tensor.Broadcast Method

Definition

Overloads

Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>)

Broadcast the data from source to the smallest broadcastable shape compatible with lengthsSource. Creates a new Tensor<T> and allocates new memory.

Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)

Broadcast the data from source to the new shape lengths. Creates a new Tensor<T> and allocates new memory. If the shape of the source is not compatible with the new shape, an exception is thrown.

Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>)

Source:
TensorExtensions.cs

Broadcast the data from source to the smallest broadcastable shape compatible with lengthsSource. Creates a new Tensor<T> and allocates new memory.

public:
generic <typename T>
 static System::Numerics::Tensors::Tensor<T> ^ Broadcast(System::Numerics::Tensors::ReadOnlyTensorSpan<T> % source, System::Numerics::Tensors::ReadOnlyTensorSpan<T> % lengthsSource);
public static System.Numerics.Tensors.Tensor<T> Broadcast<T> (scoped in System.Numerics.Tensors.ReadOnlyTensorSpan<T> source, scoped in System.Numerics.Tensors.ReadOnlyTensorSpan<T> lengthsSource);
static member Broadcast : ReadOnlyTensorSpan * ReadOnlyTensorSpan -> System.Numerics.Tensors.Tensor<'T>
Public Function Broadcast(Of T) (ByRef source As ReadOnlyTensorSpan(Of T), ByRef lengthsSource As ReadOnlyTensorSpan(Of T)) As Tensor(Of T)

Type Parameters

T

Parameters

lengthsSource
ReadOnlyTensorSpan<T>

Other Tensor<T> to make shapes broadcastable.

Returns

Applies to

Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)

Source:
TensorExtensions.cs

Broadcast the data from source to the new shape lengths. Creates a new Tensor<T> and allocates new memory. If the shape of the source is not compatible with the new shape, an exception is thrown.

public:
generic <typename T>
 static System::Numerics::Tensors::Tensor<T> ^ Broadcast(System::Numerics::Tensors::ReadOnlyTensorSpan<T> % source, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.Tensor<T> Broadcast<T> (scoped in System.Numerics.Tensors.ReadOnlyTensorSpan<T> source, scoped ReadOnlySpan<IntPtr> lengths);
static member Broadcast : ReadOnlyTensorSpan * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.Tensor<'T>
Public Function Broadcast(Of T) (ByRef source As ReadOnlyTensorSpan(Of T), lengths As ReadOnlySpan(Of IntPtr)) As Tensor(Of T)

Type Parameters

T

Parameters

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

ReadOnlySpan<T> of the desired new shape.

Returns

Exceptions

Thrown when the shapes are not broadcast compatible.

Applies to