ivy icon indicating copy to clipboard operation
ivy copied to clipboard

Added trace to Torch frontend

Open JamieLine opened this issue 2 years ago • 3 comments

Fixes #4078

JamieLine avatar Sep 05 '22 23:09 JamieLine

I think what happened was I looked at trace and thought "Oh that's simple enough I'll quickly do that" and stopped thinking so in the process I over complicated it, now that you've mentioned it using ivy.trace is clearly the correct way to do this.

JamieLine avatar Sep 08 '22 17:09 JamieLine

I have genuinely no idea why this PR closed itself, I checked nothing was merged into the main repo, I simply fixed a merge conflict while updating my codebase as this was needed to make the code work, and now it has decided that by pushing this merge into my codebase I have closed this, which was not my intent.

JamieLine avatar Sep 13 '22 00:09 JamieLine

I've made the suggested change, and as helpers.get_dtype("numeric") won't read the unsupported_dtypes flag it has the assume("float16" not in dtype) line as suggested in the internal chat.

JamieLine avatar Sep 13 '22 01:09 JamieLine

The type conversion is done to match Torch's behaviour, and it's done slightly early as a safety measure against overflows, it appears that Torch does the conversion in the same place. Without the int64 conversion Hypothesis will find cases where the dtypes disagree between Ivy and Torch.

The unsupported_dtypes flag is ignored because the function _get_dtypes is only checking in the case where the function is a backend function, should I make a PR to edit make it read the flag in all cases? This screenshot should help make things clearer. In the case that fn is a frontend function, then _get_dtypes is invariant in what function fn actually is.

image

JamieLine avatar Sep 14 '22 17:09 JamieLine

I've messaged Ved about it

JamieLine avatar Sep 15 '22 16:09 JamieLine

https://github.com/unifyai/ivy/pull/4518

JamieLine avatar Sep 15 '22 17:09 JamieLine

Pulled in change to testing framework from master

JamieLine avatar Sep 16 '22 18:09 JamieLine

The testing weirdness has been resolved, and the CI test passes on this function, it only fails on others.

JamieLine avatar Sep 16 '22 20:09 JamieLine