Tensor.Broadcast 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>) |
将数据从 |
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>) |
将数据从 |
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlyTensorSpan<T>)
- Source:
- TensorExtensions.cs
- Source:
- TensorExtensions.cs
将数据从 source
广播到与 lengthsSource
兼容的最小可广播形状。 创建新的 Tensor<T> 并分配新内存。
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)
类型参数
- T
参数
- source
- ReadOnlyTensorSpan<T>
输入 Tensor<T>。
- lengthsSource
- ReadOnlyTensorSpan<T>
其他 Tensor<T> 使形状可广播。
返回
适用于
Broadcast<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)
- Source:
- TensorExtensions.cs
- Source:
- TensorExtensions.cs
将数据从 source
广播到新形状 lengths
。 创建新的 Tensor<T> 并分配新内存。
如果 source
的形状与新形状不兼容,则会引发异常。
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)
类型参数
- T
参数
- source
- ReadOnlyTensorSpan<T>
输入 Tensor<T>。
- lengths
-
ReadOnlySpan<nativeint>
所需新形状的 ReadOnlySpan<T>。
返回
例外
当形状不兼容时引发。