model.valueWithGradient - ambiguous context error

Hi @sgugger,

Have you seen this error before in the SwiftAI repo, for notebook 3 on batch training? I’m relatively new to Swift4TF and do not know how to remedy the error. To be clear, I’ve only added 1 line to the nb, at the very top:
%system git clone https://github.com/fastai/fastai_dev.git && mv fastai_dev/swift/* /content

oh, should be valueWithGradient(at: model) rather than model.valueWithGradient before the trailing closure!

That’s weird, I don’t have the bug on my side. Do you know which toolchain you are running?

I’m using a Swift kernel in Colab. I could not figure out how to install Swift with Jupyter on my Mac.

The default toolchain as used in Colab. I assume it’s the latest?

Not the latest nightly build, but the latest release yes. That’s weird.

To reduce API surface area, we’ve removed “method-style” differential operators in favor of keeping only top-level differential operators. “Method-style” differential operators were deprecated in a previous release, perhaps warnings don’t appear in Colab.

Things should work if you rewrite model.valueWithGradient { model in ... } with valueWithGradient(at: model) { model in ... }.

3 Likes