Table of Contents

Class ElementwiseBinary

Namespace
NVMathNet.Tensor
Assembly
NVMath.Net.dll

Element-wise binary operation: D[modeD] = opAC(alpha · opA(A[modeA]), gamma · opC(C[modeC])).

public sealed class ElementwiseBinary : TensorOperation, IAsyncDisposable, IDisposable

Inheritance

Implements

Inherited Members

Constructors

ElementwiseBinary(long[], int[], long[], int[], long[], int[], TensorDataType, CuTensorOperator, CuTensorOperator, CuTensorOperator, TensorContractionOptions?, CudaStream?)

Creates an element-wise binary operation.

public ElementwiseBinary(long[] extentA, int[] modeA, long[] extentC, int[] modeC, long[] extentD, int[] modeD, TensorDataType dataType = TensorDataType.Float32, CuTensorOperator opA = CuTensorOperator.Identity, CuTensorOperator opC = CuTensorOperator.Identity, CuTensorOperator opAC = CuTensorOperator.Add, TensorContractionOptions? options = null, CudaStream? stream = null)

Parameters

extentA long[]

Sizes of the dimensions of A.

modeA int[]

Mode labels of A.

extentC long[]

Sizes of the dimensions of C.

modeC int[]

Mode labels of C; must equal modeD.

extentD long[]

Sizes of the dimensions of D (output).

modeD int[]

Mode labels of D.

dataType TensorDataType

Element type of all tensors. Default: float.

opA CuTensorOperator

Unary operator applied to A. Default: identity.

opC CuTensorOperator

Unary operator applied to C. Default: identity.

opAC CuTensorOperator

Binary operator combining the two terms. Default: add.

options TensorContractionOptions?

Options; null uses defaults.

stream CudaStream?

Optional external stream.

Methods

Execute(nint, nint, nint, double, double)

Executes the operation on device pointers.

public void Execute(nint pA, nint pC, nint pD, double alpha = 1, double gamma = 1)

Parameters

pA nint
pC nint
pD nint
alpha double
gamma double

ExecuteAsync(nint, nint, nint, double, double, CancellationToken)

Asynchronous version of NVMathNet.Tensor.ElementwiseBinary.Execute(System.IntPtr,System.IntPtr,System.IntPtr,System.Double,System.Double).

public Task ExecuteAsync(nint pA, nint pC, nint pD, double alpha = 1, double gamma = 1, CancellationToken ct = default)

Parameters

pA nint
pC nint
pD nint
alpha double
gamma double
ct CancellationToken

Returns

Task

ExecuteAsync<T>(DeviceBuffer<T>, DeviceBuffer<T>, DeviceBuffer<T>, double, double, CancellationToken)

Executes the operation on device pointers.

public Task ExecuteAsync<T>(DeviceBuffer<T> a, DeviceBuffer<T> c, DeviceBuffer<T> d, double alpha = 1, double gamma = 1, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>
c DeviceBuffer<T>
d DeviceBuffer<T>
alpha double
gamma double
ct CancellationToken

Returns

Task

Type Parameters

T