When can I use autodiff on the default Xcode toolchain?

Importing autodiff with import _Differentiation works on the 5.3 release of Swift from here, but not on the default Xcode 12 toolchain, even though at that link it says "Swift 5.3 is available as part of Xcode 12". I realize this is proprietary software I'm asking about, but does anyone have an estimate of when I'll be able to import _Differentiation with the default Xcode toolchain?

It's just nice to have an obvious and automatically updated toolchain to use when working with a team.

1 Like

Apple has not included the changes from the Swift for TensorFlow (S4TF) fork in their fork of the Swift toolchain. If and when they do is known only to Apple. It's not a given that Apple will ever include S4TF into the Xcode default toolchain.

1 Like

Differentiable programming is only available in development snapshots because it is not an official feature and needs to go through Swift Evolution. However, if you'd like to use _Differentiation with the Xcode toolchain to try out the feature at your own risk, you can create a Swift package with source files under stdlib/public/Differentiation and import that. This package should look like the following:

  • Your package
    • _Differentiation module (The name must be _Differentiation!)
      • Differentiable.swift
      • A file containing _fatalErrorForwardModeDifferentiationDisabled copied from DifferentiationUtilities.swift
    • Differentiation module (or any name), compiled with unsafe flag -parse-stdlib
      • @_exported import _Differentiation
      • The rest of source files in stdlib/public/Differentiation, excluding _fatalErrorForwardModeDifferentiationDisabled()

Hope this helps! Please do note that this may break in the future and should only be used for experimental purposes.

Terms of Service

Privacy Policy

Cookie Policy