You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TF-1008 SILOptimizer: differentiation transform support for zeroTangentVectorInitializer
Issue Description:
In the following code, S.c doesn't always contribute to the gradient. When it doesn't, instead of producing a zero gradient, it causes a runtime error.
Also, maybe it should be a separate bug, but even when 'condition' is true and S.c contributes to the gradient, the gradient is incorrect.
letcondition = false//crashletcondition = true//no crashstructS: Differentiable{
vara: Float = 9varb: Float = 3varc: [Float] = [2.2]
mutatingfuncchangeMyself(){
a += b * 3c = c + [a] // when 'condition' is false -> Precondition failed: + should receive gradient with count equal to sum of operand counts, but counts are: gradient 0, lhs 1, rhs 1ifcondition{
a += c.differentiableReduce(0, +)
}
}
}
funcinsertVerbHere(s: S) -> Float{
vars = ss.changeMyself()
returns.a
}
letgrad = valueWithGradient(of: insertVerbHere)
print(grad(S()))
//Separate bug://when condition is true://prints (value: 38.2, gradient: S.TangentVector(a: 1.0, b: 0.0, c: []))//but should be //(value: 38.2, gradient: S.TangentVector(a: 2.0, b: 6.0, c: [1.0]))
The text was updated successfully, but these errors were encountered:
Thanks for reporting! At a quick glance, this seems like a dupe of TF-1005 (per-instance zero tangent vectors) - the issue description has a similar example (non-active struct member) with the same precondition.
I plan to look into TF-1005 soon! TF-1008 is the specific ticket that tracks fixing this issue.
I believe this has been fixed by PR #37861. When I build and run the above reproducer in both true and false cases, the application runs without a crash and produces the correct gradient.
Environment
0.8 release
Additional Detail from JIRA
md5: 0d299597209d0d52d44fd099073b0ada
is blocked by:
zeroTangentVectorInitializer
Issue Description:
In the following code, S.c doesn't always contribute to the gradient. When it doesn't, instead of producing a zero gradient, it causes a runtime error.
Also, maybe it should be a separate bug, but even when 'condition' is true and S.c contributes to the gradient, the gradient is incorrect.
The text was updated successfully, but these errors were encountered: