blob: 2a6e9ffd0f3dbf1ca4af08a89bdc40a0214e1347 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//TEST:LANG_SERVER:
RWStructuredBuffer<float> outputBuffer;
[ForwardDifferentiable]
float f(float x)
{
return x * x;
}
[ForwardDifferentiable]
float df(float x)
{
//HOVER:14,17
return __fwd_diff();
}
[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
outputBuffer[0] = __fwd_diff(df)(DifferentialPair<float>(x, 1.0)).d(); // Expect: 2.0
}
|