Tensor.Broadcast Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>) |
Broadcast the data from |
| Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>) |
Broadcast the data from |
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)
- Source:
- Tensor.cs
- Source:
- TensorExtensions.cs
- Source:
- Tensor.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
- source
- ReadOnlyTensorSpan<T>
Input Tensor<T>.
- lengths
-
ReadOnlySpan<nativeint>
ReadOnlySpan<T> of the desired new shape.
Returns
Exceptions
The shapes are not broadcast compatible.
Remarks
A rank-zero empty source or an empty lengths span is treated as the shape [0] when checking broadcast compatibility. Explicitly specified dimension lengths are preserved.
Applies to
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>)
- Source:
- Tensor.cs
- Source:
- TensorExtensions.cs
- Source:
- Tensor.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
- source
- ReadOnlyTensorSpan<T>
Input Tensor<T>.
- lengthsSource
- ReadOnlyTensorSpan<T>
Other Tensor<T> to make shapes broadcastable.
Returns
Remarks
Rank-zero empty spans are treated as empty vectors with shape [0] when checking broadcast compatibility. Explicitly specified dimension lengths are preserved.