TensorPrimitives.Sum 方法

定义

重载

Sum(ReadOnlySpan<Single>)

计算指定张量中单精度浮点数中的所有元素的总和。

Sum<T>(ReadOnlySpan<T>)

计算指定数值张量中的所有元素的总和。

Sum(ReadOnlySpan<Single>)

Source:
TensorPrimitives.cs
Source:
TensorPrimitives.Single.cs
Source:
TensorPrimitives.Single.cs

计算指定张量中单精度浮点数中的所有元素的总和。

public:
 static float Sum(ReadOnlySpan<float> x);
public static float Sum (ReadOnlySpan<float> x);
static member Sum : ReadOnlySpan<single> -> single
Public Shared Function Sum (x As ReadOnlySpan(Of Single)) As Single

参数

x
ReadOnlySpan<Single>

张量,表示为范围。

返回

x中添加所有元素的结果;如果 x 为空,则为零。

注解

如果输入中的任何值等于 NaN,则结果也是 NaN。

此方法可以调用基础 C 运行时,或使用特定于当前体系结构的说明。 不同的操作系统或体系结构之间的确切结果可能有所不同。

适用于

Sum<T>(ReadOnlySpan<T>)

Source:
TensorPrimitives.Sum.cs
Source:
TensorPrimitives.Sum.cs

计算指定数值张量中的所有元素的总和。

public:
generic <typename T>
 where T : System::Numerics::IAdditionOperators<T, T, T>, System::Numerics::IAdditiveIdentity<T, T> static T Sum(ReadOnlySpan<T> x);
public static T Sum<T> (ReadOnlySpan<T> x) where T : System.Numerics.IAdditionOperators<T,T,T>, System.Numerics.IAdditiveIdentity<T,T>;
static member Sum : ReadOnlySpan<'T (requires 'T :> System.Numerics.IAdditionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IAdditiveIdentity<'T, 'T>)> -> 'T (requires 'T :> System.Numerics.IAdditionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IAdditiveIdentity<'T, 'T>)
Public Shared Function Sum(Of T As {IAdditionOperators(Of T, T, T), IAdditiveIdentity(Of T, T)}) (x As ReadOnlySpan(Of T)) As T

类型参数

T

参数

x
ReadOnlySpan<T>

张量,表示为范围。

返回

T

x中添加所有元素的结果;如果 x 为空,则为零。

注解

如果输入中的任何值等于 NaN,则结果也是 NaN。

此方法可以调用基础 C 运行时,或使用特定于当前体系结构的说明。 不同的操作系统或体系结构之间的确切结果可能有所不同。

适用于