6 Limitations
performance of the generated code can be very poor in some situations.
Differentiating involves first expanding the given expression. The expansion might include bindings not provided by any module. It may be inconvenient or impossible to attach backpropagators to these.
Multiple return values are not supported anywhere in the expansion of the expression being differentiated.
Use of case-lambda is not supported anywhere in the expansion, which includes any use of keyword arguments or default values.
Nested uses of grad and D+ are possible, but the transformed syntax can get very large from expansion by a constant factor with each nested use. The expanded expression is likely to be subject to extensive optimization by the Racket compiler, but this doesn’t stop the expansion growing very large beforehand. In practice, derivatives higher than second order can become unreasonably large.
Some error messages could be more informative!
Continuations, parameters, exceptions and similar are likely to behave unexpectedly.