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
import _Differentiation
structStruct:Differentiable{varx:Float@differentiable // either this
func method()->Float{ x }@derivative(of: method) // or this is sufficient to trigger error
func vjpMethod()->(value:Float, pullback:(Float)->TangentVector){fatalError()}mutatingfunc move(along direction:TangentVector){}}
// Try to get the `TangentVector` type witness, in case the conformance has// not been fully checked.
Type tanType = conf.getTypeWitnessByName(type, ctx.Id_TangentVector);
if (tanType.isNull() || tanType->hasError())
return ProtocolConformanceRef();
return conf;
Attribute type-checking should be changed to drop TangentVector type witness resolution. This should simplify code and make things less hacky.
The text was updated successfully, but these errors were encountered:
The problematic code (forcibly resolving Differentiable.TangentVector type witnesses) has been removed. Derivative function type calculation now returns llvm::Expected, checking type witnesses on-demand.
Additional Detail from JIRA
md5: 2982851f9d316dc7f87ad75961ebafac
Issue Description:
This occurs because
@differentiable
and@derivative
attribute type-checking currently tries to resolveDifferentiable.TangentVector
type witnesses, which is ad-hoc logic that messes upDifferentiable
derived conformances.Attribute type-checking should be changed to drop
TangentVector
type witness resolution. This should simplify code and make things less hacky.The text was updated successfully, but these errors were encountered: