Skip to content

DifferentiableAttribute

1 min read

Import: import system.gpu;

This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.

DifferentiableAttribute

Makes a inferred shader helper differentiable, so GpuDiff.forward and GpuDiff.backward can compute its derivatives automatically. Every function it calls must itself be differentiable: another @differentiable helper or a differentiable built-in such as GpuMath.sin, GpuMath.exp or GpuMath.max. Other calls are build errors at the call. Works on every target, including WebGpu.

public struct DifferentiableAttribute