ivy
ivy copied to clipboard
fix ivy.dropout returning native arrays/tensors
Fixes problem where ivy.dropout can return things like tf.EagerTensor instead of ivy.Array.
Min example:
import ivy
if __name__ == '__main__':
ivy.set_backend("tensorflow")
x = ivy.random_normal(shape=(5, 5, 5))
x = ivy.dropout(x, 0.1)
print(type(x))
x = x.reshape((25, 5))
If you are working on an open task, please edit the PR description to link to the issue you've created.
For more information, please check ToDo List Issues Guide.
Thank you :hugs:
Why was it returning native arrays? It is a composition of ivy functions so this shouldn't be happening 🤔
@AnnaTz I've honestly got no idea what the problem is here, all the inner ivy functions seem to be working fine and when I create an identical sample dropout function in a test script it also returns ivy arrays rather than native. So I guess there must be some other problem within ivy that's causing this, but I'm no expert on what it could be 😅. What do you think we should do here? This solution does solve the problem ^
@AnnaTz I've honestly got no idea what the problem is here, all the inner ivy functions seem to be working fine and when I create an identical sample dropout function in a test script it also returns ivy arrays rather than native. So I guess there must be some other problem within ivy that's causing this, but I'm no expert on what it could be 😅. What do you think we should do here? This solution does solve the problem ^
I think I figured it out. dropout
is a mixed function so it should have amixed_backend_wrappers
attribute to define its decorators as in interpolate for example.
@AnnaTz Ah yes, looks like that solved it. Nice spot! Have updated this PR