We want to obtain derivatives in discontinuous program code, where default Algorithmic Differentiation may not perform well. Specifically, we consider discontinuities induced by control flow statements, where meaningful derivatives should ideally be capable of representing the resulting kinks in the trajectory. To achieve this, one can interpolate the trajectory at the control flow statements before taking the derivative. We formulate a method to efficiently interpolate between all boundaries induced by control flow in program code. Theoretically, code can be viewed as a series of piecewise continuous functions applied in succession. These functions are nested inside one another and result in a function composition with several cases. We interpret this function composition as a tree and devise a heuristic to identify paths that are relevant to the interpolation. This allows us to conceive a language that smoothly interpolates control-flow statements automatically and efficiently, making it fully differentiable.
翻译:我们希望在非连续程序代码中获取导数,而默认的算法微分在此场景下表现欠佳。具体而言,我们考虑由控制流语句引发的不连续性——理想情况下,有意义的导数应能表征轨迹中由此产生的折点。为达成此目标,可在求导前对控制流语句处的轨迹进行插值。我们提出一种方法,可对程序代码中由控制流引发的所有边界进行高效插值。从理论层面看,代码可视为一系列逐段连续函数依次作用的结果。这些函数相互嵌套,形成包含多种情形的函数复合结构。我们将此函数复合关系解析为树状结构,并设计启发式策略以识别与插值相关的路径。基于此,我们构建了一种能够自动且高效地对控制流语句进行平滑插值的语言,使其实现完全可微。