TensorPrimitives.Round 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| Round<T>(ReadOnlySpan<T>, Span<T>) |
計算指定張量中數字的元素四捨五入 |
| Round<T>(ReadOnlySpan<T>, Int32, Span<T>) |
計算指定張量中數字的元素四捨五入 |
| Round<T>(ReadOnlySpan<T>, MidpointRounding, Span<T>) |
計算指定張量中數字的元素四捨五入 |
| Round<T>(ReadOnlySpan<T>, Int32, MidpointRounding, Span<T>) |
計算指定張量中數字的元素四捨五入 |
Round<T>(ReadOnlySpan<T>, Span<T>)
計算指定張量中數字的元素四捨五入
public:
generic <typename T>
where T : System::Numerics::IFloatingPoint<T> static void Round(ReadOnlySpan<T> x, Span<T> destination);
public static void Round<T>(ReadOnlySpan<T> x, Span<T> destination) where T : System.Numerics.IFloatingPoint<T>;
static member Round : ReadOnlySpan<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> * Span<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> -> unit (requires 'T :> System.Numerics.IFloatingPoint<'T>)
Public Shared Sub Round(Of T As IFloatingPoint(Of T)) (x As ReadOnlySpan(Of T), destination As Span(Of T))
類型參數
- T
參數
以範圍表示的張量。
- destination
- Span<T>
目的地張量,以範圍表示。
例外狀況
x 和 destination 參考重疊的記憶體位置,而且不會從相同的位置開始。
備註
這個方法會有效地計算 。destination[i] = T.Round(x[i])
適用於
Round<T>(ReadOnlySpan<T>, Int32, Span<T>)
計算指定張量中數字的元素四捨五入
public:
generic <typename T>
where T : System::Numerics::IFloatingPoint<T> static void Round(ReadOnlySpan<T> x, int digits, Span<T> destination);
public static void Round<T>(ReadOnlySpan<T> x, int digits, Span<T> destination) where T : System.Numerics.IFloatingPoint<T>;
static member Round : ReadOnlySpan<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> * int * Span<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> -> unit (requires 'T :> System.Numerics.IFloatingPoint<'T>)
Public Shared Sub Round(Of T As IFloatingPoint(Of T)) (x As ReadOnlySpan(Of T), digits As Integer, destination As Span(Of T))
類型參數
- T
參數
以範圍表示的張量。
- digits
- Int32
x 中數位應四捨五入的小數位數。
- destination
- Span<T>
目的地張量,以範圍表示。
例外狀況
x 和 destination 參考重疊的記憶體位置,而且不會從相同的位置開始。
備註
這個方法會有效地計算 。destination[i] = T.Round(x[i], digits)
適用於
Round<T>(ReadOnlySpan<T>, MidpointRounding, Span<T>)
計算指定張量中數字的元素四捨五入
public:
generic <typename T>
where T : System::Numerics::IFloatingPoint<T> static void Round(ReadOnlySpan<T> x, MidpointRounding mode, Span<T> destination);
public static void Round<T>(ReadOnlySpan<T> x, MidpointRounding mode, Span<T> destination) where T : System.Numerics.IFloatingPoint<T>;
static member Round : ReadOnlySpan<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> * MidpointRounding * Span<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> -> unit (requires 'T :> System.Numerics.IFloatingPoint<'T>)
Public Shared Sub Round(Of T As IFloatingPoint(Of T)) (x As ReadOnlySpan(Of T), mode As MidpointRounding, destination As Span(Of T))
類型參數
- T
參數
以範圍表示的張量。
- mode
- MidpointRounding
應捨入 x 的模式。
- destination
- Span<T>
目的地張量,以範圍表示。
例外狀況
x 和 destination 參考重疊的記憶體位置,而且不會從相同的位置開始。
備註
這個方法會有效地計算 。destination[i] = T.Round(x[i], mode)
適用於
Round<T>(ReadOnlySpan<T>, Int32, MidpointRounding, Span<T>)
計算指定張量中數字的元素四捨五入
public:
generic <typename T>
where T : System::Numerics::IFloatingPoint<T> static void Round(ReadOnlySpan<T> x, int digits, MidpointRounding mode, Span<T> destination);
public static void Round<T>(ReadOnlySpan<T> x, int digits, MidpointRounding mode, Span<T> destination) where T : System.Numerics.IFloatingPoint<T>;
static member Round : ReadOnlySpan<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> * int * MidpointRounding * Span<'T (requires 'T :> System.Numerics.IFloatingPoint<'T>)> -> unit (requires 'T :> System.Numerics.IFloatingPoint<'T>)
Public Shared Sub Round(Of T As IFloatingPoint(Of T)) (x As ReadOnlySpan(Of T), digits As Integer, mode As MidpointRounding, destination As Span(Of T))
類型參數
- T
參數
以範圍表示的張量。
- digits
- Int32
x 中數位應四捨五入的小數位數。
- mode
- MidpointRounding
應捨入 x 的模式。
- destination
- Span<T>
目的地張量,以範圍表示。
例外狀況
mode 無效。
digits 無效。
備註
這個方法會有效地計算 。destination[i] = T.Round(x[i], digits, mode)