• Slang Standard Library Reference
    • Interfaces
    • Types
      • Buffer types
      • Math types
      • Miscelaneous types
      • Ray-tracing
      • Sampler types
      • Scalar types
      • Stage IO types
      • Texture types
      • Array
      • Atomic
      • AtomicAdd
      • ConstantBuffer
      • CoopMat
      • CoopMatMatrixLayout
      • CoopMatMatrixOperands
      • CoopMatMatrixUse
      • CoopMatScope
      • CoopVec
      • CoopVecComponentType
      • CoopVecMatrixLayout
      • DescriptorAccess
      • DescriptorHandle
      • DescriptorKind
      • DiffTensorView
      • DifferentialPair
        • Differential
        • DifferentialElementType
        • d
        • dadd
        • dmul
        • dzero
        • getDifferential
        • getPrimal
        • init
        • p
        • v
      • DifferentialPtrPair
      • DispatchNodeInputRecord
      • NodePayloadPtr
      • NullDifferential
      • Optional
      • ParameterBlock
      • Ptr
      • String
      • TensorView
      • TorchTensor
      • Tuple
      • _AttributeTargets
      • int8_t4_packed
      • uint8_t4_packed
    • Attributes
    • Global Declarations

struct DifferentialPair<T>

Conforms to: IDifferentiable

Description

DifferentialPair<T> is a built-in type that carries both the original and derivative value of a term. It is defined as follows:

struct DifferentialPair<T : IDifferentiable> : IDifferentiable
{
    typealias Differential = DifferentialPair<T.Differential>;
    property T p {get;}
    property T.Differential d {get;}
    static Differential dzero();
    static Differential dadd(Differential a, Differential b);
}

Differential pairs can be created via constructor or through the diffPair() operation

DifferentialPair<float> dpa = DifferentialPair<float>(1.0f, 2.0f);
DifferentialPair<float> dpa = diffPair(1.0f, 2.0f);

Note that derivative pairs are used to pass derivatives into and out of auto-diff functions. See documentation on fwd_diff and bwd_diff operators for more information.

Generic Parameters

T: IDifferentiable

m_currentPage->path

d

p

v

Methods