fastai / fastai_dev

fast.ai early development experiments
Apache License 2.0
638 stars 350 forks source link

[Swift] Remove custom derivative for `LearningPhaseDependent.forward`. #309

Closed dan-zheng closed 4 years ago

dan-zheng commented 4 years ago

Work around issues with @differentiable + @derivative attributes with different derivative generic signatures.

Automatic differentiation can handle this enum switch now, so a custom derivative is no longer necessary.

https://bugs.swift.org/browse/TF-1037 tracks this issue. Related discussion: https://github.com/apple/swift/pull/28621#issuecomment-562763390


Unblocks https://github.com/apple/swift/pull/28621. Verified that swift build in fastai_dev/swift/FastaiNotebook_11_imagenette succeeds with a toolchain built from https://github.com/apple/swift/pull/28621.

review-notebook-app[bot] commented 4 years ago

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

dan-zheng commented 4 years ago

Merging to unblock progress, happy to address comments later!

sgugger commented 4 years ago

Was looking good to me anyway, but yes, always feel free to merge directly here. Will port the fix to swiftai.

dan-zheng commented 4 years ago

Was looking good to me anyway, but yes, always feel free to merge directly here. Will port the fix to swiftai.

Thank you!