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, IDisposableInheritance
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
extentAlong[]-
Sizes of the dimensions of A.
modeAint[]-
Mode labels of A.
extentClong[]-
Sizes of the dimensions of C.
modeCint[]-
Mode labels of C; must equal
modeD. extentDlong[]-
Sizes of the dimensions of D (output).
modeDint[]-
Mode labels of D.
dataTypeTensorDataType-
Element type of all tensors. Default: float.
opACuTensorOperator-
Unary operator applied to A. Default: identity.
opCCuTensorOperator-
Unary operator applied to C. Default: identity.
opACCuTensorOperator-
Binary operator combining the two terms. Default: add.
optionsTensorContractionOptions?-
Options;
nulluses defaults. streamCudaStream?-
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
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
Returns
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
aDeviceBuffer<T>cDeviceBuffer<T>dDeviceBuffer<T>alphadoublegammadoublectCancellationToken
Returns
Type Parameters
T