New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented torch.nn.functional.dropout2d #15643
Conversation
Currently this function is not working due to #15475, and Im trying to fix it in the mean time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Ali-12122. Hope you're doing well. Can you kindly refactor your implementation to use ivy.dropout2d
instead since it has been added to ivy
in this commit here. That should also resolve the issue with ivy.bernoulli
you were facing and we can then get the PR to merge after it passes all tests. Thanks!
absolutely, thank you. |
Hi @hmahmood24, so I have refactored my code as we previously agreed, but for some reason I can't get my test to run, neither was I able to run the other test in the file, When running any test, i get this horrendous error log.
What am I doing wrong? Thanks in advance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Ali-12122. Thanks for making the changes. I have requested just a couple more changes for you to make. Regarding the bug you were facing, try re-syncing with master
and running the tests again. That bug should be resolved now. If you face any other problems or isses, feel free to reach out or re-request a review once done. Thanks! :)
if not training: | ||
return tensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass the training
parameter as it is to the ivy.dropout2d
function since it can handle these checks itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to pass all the parameters to ivy.dropout2d
but it throws errors if I pass anything other than prob, I'll try to see if this will be solved be re-syncing with master
, if not, I'll create a bug report and link it here.
if not training: | ||
return tensor | ||
|
||
ret = tensor.dropout2d(prob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to use ivy.dropout
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used ivy.dropout2d
because we agreed to do so, should I use ivy.dropout
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
ivy.dropout2d
because we agreed to do so, should I useivy.dropout
instead?
Oh sorry I meant ivy.dropout2d
haha. You have used tensor.dropout2d
which doesn't exist. You have to use ivy.dropout2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me if I am missing something but isn't this use case similar to what I'm doing?
or maybe I should use ivy.dropout2d()
incase tensor
is not an ivy.Array
?
@hmahmood24 so I have passed the arguments to
what am I doing wrong? |
|
@hmahmood24 Thank you for your time, energy, and effort with me man, really. I'll try again using again, thank you for everything. |
okay, @to_ivy_arrays_and_back
def dropout2d(tensor, prob=0.5, training=True, data_format="NCHW", inplace=False):
if tensor.ndim < 2:
raise ValueError("Feature dropout requires at least 2 dimensions in the input")
ret = ivy.dropout2d(tensor, prob, training=training, data_format=data_format)
if inplace:
ivy.inplace_update(tensor, ret)
return tensor
return ret
rando = ivy.asarray([
[1, 2, 3, 4],
[4, 5, 6, 7],
[7, 8, 9, 10]
])
z = dropout2d(tensor=rando, prob=0.5, training=False, data_format="NCHW", inplace=False)
print(z) throws this error: C:\Users\aliam\.conda\envs\ivy_dev\python.exe C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\nn\functional\dropout_functions.py
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\nn\functional\dropout_functions.py", line 5, in <module>
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\__init__.py", line 252, in <module>
from . import nn
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\nn\__init__.py", line 1, in <module>
from . import functional
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\nn\functional\__init__.py", line 5, in <module>
from . import dropout_functions
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\nn\functional\dropout_functions.py", line 35, in <module>
z = dropout2d(tensor=rando, prob=0.5, training=False, data_format="NCHW", inplace=False)
File "C:\Users\aliam\ivy\ivy\ivy\functional\frontends\torch\func_wrapper.py", line 84, in outputs_to_frontend_arrays_torch
ivy.set_default_float_dtype(torch_frontend.get_default_dtype())
AttributeError: partially initialized module 'ivy.functional.frontends.torch' has no attribute 'get_default_dtype' (most likely due to a circular import)
Process finished with exit code 1 Is this from me or should I go make a bug report? Thanks in advance. |
I think you need to make the changes in your code first and then I'll look at the logs from the CI tests to see what's going on. Can you kindly make the changes I requested first? |
|
||
|
||
@to_ivy_arrays_and_back | ||
def dropout2d(tensor, prob=0.5, training=True, data_format="NCHW", inplace=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original torch
function doesn't have a data_format
argument as seen here. Can you please remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I've missed that, I will remove it, thank you for mentioning it.
if tensor.ndim < 2: | ||
raise ValueError("Feature dropout requires at least 2 dimensions in the input") | ||
|
||
ret = tensor.dropout2d(prob, training=training, data_format=data_format) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ivy.dropout2d
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely.
…tion signature to be identical to torch
I used I have also set I re-ran the test and got this error log: INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\_pytest\main.py", line 265, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\_pytest\config\__init__.py", line 1046, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\pluggy\_hooks.py", line 277, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\pluggy\_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "C:\Users\aliam\ivy\ivy\ivy_tests\test_ivy\conftest.py", line 86, in pytest_configure
INTERNALERROR> test_globals.FWS_DICT[backend_str](),
INTERNALERROR> File "C:\Users\aliam\ivy\ivy\ivy_tests\test_ivy\helpers\globals.py", line 21, in <lambda>
INTERNALERROR> FWS_DICT["jax"] = lambda x=None: _get_ivy_jax(x)
INTERNALERROR> File "C:\Users\aliam\ivy\ivy\ivy_tests\test_ivy\helpers\globals.py", line 76, in _get_ivy_jax
INTERNALERROR> import ivy.functional.backends.jax
INTERNALERROR> File "C:\Users\aliam\ivy\ivy\ivy\functional\backends\jax\__init__.py", line 21, in <module>
INTERNALERROR> register_pytree_node(
INTERNALERROR> File "C:\Users\aliam\.conda\envs\ivy_dev\lib\site-packages\jax\_src\tree_util.py", line 137, in register_pytree_node
INTERNALERROR> pytree.register_node(nodetype, flatten_func, unflatten_func)
INTERNALERROR> ValueError: Duplicate custom PyTreeDef type registration for <class 'ivy.data_classes.container.container.Container'>.
Process finished with exit code 3
Empty suite |
x=x[0], | ||
prob=prob, | ||
training=training, | ||
data_format=data_format, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input parameters need to be renamed here as well i.e. x
will be input
, prob
to p
and data_format
will be removed since it doesn't exist in the original function's signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely
prob=prob, | ||
training=training, | ||
data_format=data_format, | ||
return_flat_np_arrays=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think you need this here since this is handled in the helpers.flatten_and_to_np
function right below. Can you elaborate on why you added this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, I'll remove it.
Can you elaborate on why you added this?
I didn't add, I took the test for ivy.dropout2d
and tried to adapt it as much as I can to my case, I thought that would be a more correct way of doing things, but it looks like I've missed a couple of things.
please let me know if the approach I took was problematic.
), | ||
prob=helpers.floats(min_value=0, max_value=0.9), | ||
training=st.booleans(), | ||
data_format=st.sampled_from(["NCHW", "NHWC"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I'll remove it.
I'll look into this issue. Apologies for this and thanks for bringing this up. In the meantime, do address the changes I requested. Also can you run some test in another module within the |
@hmahmood24 Again, thank you for your time, energy, and efforts with me, it is much appreciated. I have made the following changes: The requested changes: 1- Removed Issues I think I fixed: 4- Removed Please let me know if I should reverse any of them. Regarding the tests, not even one ran, all of them threw errors.
|
Yeah no I think the problem is with your environment. You'll probably to work in a clean environment to get the tests running. Regarding the changes, they all seem fine to keep 👍🏼 No worries. Can you try testing in a fresh environment? |
hey @hmahmood24, so I have changed my environment, and I'm currently using a docker interpreter instead of Conda, things have improved but I'm still facing issues, all tests keep failing.
|
…but keeps failing
Hey @hmahmood24, so I have moved to GitHub codespaces and fixed some issues in my git configuration, everything runs well and other tests are working well, my test works but it keeps failing, if you could please check it out today and see where's the issue I would be extremely grateful. Thank you in advance. Here is the error log: @Ali-12122 ➜ /workspaces/ivy (torch-dropout2d) $ python3 -m pytest -v -x ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d
Use Database in ReadOnly Mode with local caching !
======================================================================================= test session starts =======================================================================================
platform linux -- Python 3.10.8, pytest-7.4.0, pluggy-1.2.0 -- /home/codespace/.python/current/bin/python3
cachedir: .pytest_cache
hypothesis profile 'ivy_profile' -> max_examples=25, print_blob=True, deadline=timedelta(milliseconds=500000), suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much, HealthCheck.data_too_large], database=MultiplexedDatabase(DirectoryBasedExampleDatabase('/workspaces/ivy/.hypothesis/examples/'), ReadOnlyDatabase(RedisExampleDatabase(Redis<ConnectionPool<Connection<host=redis-17011.c259.us-central1-2.gce.cloud.redislabs.com,port=17011,db=0>>>, expire_after=datetime.timedelta(days=8))))
backend(s): all
device: cpu
number of Hypothesis examples: 25
rootdir: /workspaces/ivy
plugins: anyio-3.7.0, hypothesis-6.79.2
collected 2 items
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d[cpu-ivy.functional.backends.numpy-False-False] FAILED [ 50%]
============================================================================================ FAILURES =============================================================================================
_______________________________________________________________ test_torch_dropout2d[cpu-ivy.functional.backends.numpy-False-False] _______________________________________________________________
args = (ivy.array([[0.]]), 0.5), kwargs = {'data_format': 'NCHW', 'training': True}
@functools.wraps(fn)
def _handle_exceptions(*args, **kwargs):
"""
Catch all exceptions and raise them in IvyException.
Parameters
----------
args
The arguments to be passed to the function.
kwargs
The keyword arguments to be passed to the function.
Returns
-------
The return of the function, or raise IvyException if error is thrown.
"""
try:
> return fn(*args, **kwargs)
ivy/utils/exceptions.py:210:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ivy/func_wrapper.py:971: in _handle_nestable
return fn(*args, **kwargs)
ivy/func_wrapper.py:399: in _handle_array_like_without_promotion
return fn(*args, **kwargs)
ivy/func_wrapper.py:863: in _handle_out_argument
return fn(*args, out=out, **kwargs)
ivy/func_wrapper.py:439: in _inputs_to_native_arrays
return fn(*new_args, **new_kwargs)
ivy/func_wrapper.py:545: in _outputs_to_ivy_arrays
ret = fn(*args, **kwargs)
ivy/functional/backends/numpy/experimental/layers.py:793: in dropout2d
x = np.transpose(x, perm)
/home/codespace/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py:668: in transpose
return _wrapfunc(a, 'transpose', axes)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([[0.]], dtype=float32), method = 'transpose', args = ((1, 2, 0),), kwds = {}, bound = <built-in method transpose of numpy.ndarray object at 0x7fd805ba83f0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E ValueError: axes don't match array
/home/codespace/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py:57: ValueError
During handling of the above exception, another exception occurred:
@handle_frontend_test(
> fn_tree="torch.nn.functional.dropout2d",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
min_value=0,
max_value=50,
allow_inf=False,
min_num_dims=2,
max_num_dims=4,
min_dim_size=1
),
prob=helpers.floats(min_value=0, max_value=0.9),
training=st.booleans(),
test_with_out=st.just(False),
test_inplace=st.just(False),
)
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py:82: in test_torch_dropout2d
ret = helpers.test_frontend_function(
ivy_tests/test_ivy/helpers/function_testing.py:608: in test_frontend_function
ret = get_frontend_ret(
ivy_tests/test_ivy/helpers/function_testing.py:1774: in get_frontend_ret
ret = frontend_fn(*args, **kwargs)
ivy/functional/frontends/torch/func_wrapper.py:87: in outputs_to_frontend_arrays_torch
ret = fn(*args, **kwargs)
ivy/functional/frontends/torch/func_wrapper.py:58: in _inputs_to_ivy_arrays_torch
return fn(*new_args, **new_kwargs)
ivy/functional/frontends/torch/nn/functional/dropout_functions.py:24: in dropout2d
ret = ivy.dropout2d(input, p, training=training, data_format="NCHW")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (ivy.array([[0.]]), 0.5), kwargs = {'data_format': 'NCHW', 'training': True}
@functools.wraps(fn)
def _handle_exceptions(*args, **kwargs):
"""
Catch all exceptions and raise them in IvyException.
Parameters
----------
args
The arguments to be passed to the function.
kwargs
The keyword arguments to be passed to the function.
Returns
-------
The return of the function, or raise IvyException if error is thrown.
"""
try:
return fn(*args, **kwargs)
# Not to rethrow as IvyBackendException
except IvyNotImplementedException as e:
raise e
except IvyError as e:
_write_traceback_history(buffer)
raise ivy.utils.exceptions.IvyError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
except IvyBroadcastShapeError as e:
_write_traceback_history(buffer)
raise ivy.utils.exceptions.IvyBroadcastShapeError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
except IvyDtypePromotionError as e:
_write_traceback_history(buffer)
raise ivy.utils.exceptions.IvyDtypePromotionError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
except (IndexError, IvyIndexError) as e:
_write_traceback_history(buffer)
raise ivy.utils.exceptions.IvyIndexError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
except (AttributeError, IvyAttributeError) as e:
_write_traceback_history(buffer)
raise ivy.utils.exceptions.IvyAttributeError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
except (ValueError, IvyValueError) as e:
_write_traceback_history(buffer)
> raise ivy.utils.exceptions.IvyValueError(
fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
)
E ivy.utils.exceptions.IvyValueError: numpy: dropout2d: File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions
E return fn(*args, **kwargs)
E File "/workspaces/ivy/ivy/func_wrapper.py", line 971, in _handle_nestable
E return fn(*args, **kwargs)
E File "/workspaces/ivy/ivy/func_wrapper.py", line 399, in _handle_array_like_without_promotion
E return fn(*args, **kwargs)
E File "/workspaces/ivy/ivy/func_wrapper.py", line 863, in _handle_out_argument
E return fn(*args, out=out, **kwargs)
E File "/workspaces/ivy/ivy/func_wrapper.py", line 439, in _inputs_to_native_arrays
E return fn(*new_args, **new_kwargs)
E File "/workspaces/ivy/ivy/func_wrapper.py", line 545, in _outputs_to_ivy_arrays
E ret = fn(*args, **kwargs)
E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 793, in dropout2d
E x = np.transpose(x, perm)
E File "<__array_function__ internals>", line 200, in transpose
E File "/home/codespace/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 668, in transpose
E return _wrapfunc(a, 'transpose', axes)
E File "/home/codespace/.local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
E return bound(*args, **kwds)
E During the handling of the above exception, another exception occurred:
E axes don't match array
E Falsifying example: test_torch_dropout2d(
E on_device='cpu',
E frontend='torch',
E dtype_and_x=(['float32'], [array([[0.]], dtype=float32)]),
E prob=0.5,
E training=True,
E fn_tree='ivy.functional.frontends.torch.nn.functional.dropout2d',
E test_flags=FrontendFunctionTestFlags(
E num_positional_args=0,
E with_out=False,
E inplace=False,
E as_variable=[False],
E native_arrays=[False],
E generate_frontend_arrays=False,
E ),
E )
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.79.2', b'AXicY2BkYAAidHAASoOlAAosAMQ=') as a decorator on your test case
ivy/utils/exceptions.py:241: IvyValueError
===================================================================================== short test summary info =====================================================================================
FAILED ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d[cpu-ivy.functional.backends.numpy-False-False] - ivy.utils.exceptions.IvyValueError: numpy: dropout2d: File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================== 1 failed in 4.89s ======================================================================================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Ali-12122, apologies for being a little late on this. I have requested a change in my review. That should resolve the issue you are facing. Thanks! :)
min_value=0, | ||
max_value=50, | ||
allow_inf=False, | ||
min_num_dims=2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The min_num_dims
needs to be 3
since torch
supports either NCL
or NCHW
in the input
@hmahmood24 Thank you for your guidance and support, I did make the change you requested, and it passed the test. @Ali-12122 ➜ /workspaces/ivy (torch-dropout2d) $ python3 -m pytest -v -x ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d
Use Database in ReadOnly Mode with local caching !
===================================================================== test session starts ======================================================================
platform linux -- Python 3.10.8, pytest-7.4.0, pluggy-1.2.0 -- /home/codespace/.python/current/bin/python3
cachedir: .pytest_cache
hypothesis profile 'ivy_profile' -> max_examples=25, print_blob=True, deadline=timedelta(milliseconds=500000), suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much, HealthCheck.data_too_large], database=MultiplexedDatabase(DirectoryBasedExampleDatabase('/workspaces/ivy/.hypothesis/examples/'), ReadOnlyDatabase(RedisExampleDatabase(Redis<ConnectionPool<Connection<host=redis-17011.c259.us-central1-2.gce.cloud.redislabs.com,port=17011,db=0>>>, expire_after=datetime.timedelta(days=8))))
backend(s): all
device: cpu
number of Hypothesis examples: 25
rootdir: /workspaces/ivy
plugins: anyio-3.7.0, hypothesis-6.79.2
collected 2 items
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d[cpu-ivy.functional.backends.numpy-False-False] PASSED [ 50%]
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py::test_torch_dropout2d[cpu-ivy.functional.backends.torch-False-False] PASSED [100%]
======================================================================= warnings summary =======================================================================
ivy_tests/test_ivy/test_frontends/test_torch/test_dropout_functions.py: 42 warnings
/home/codespace/.local/lib/python3.10/site-packages/torch/nn/functional.py:1338: UserWarning: dropout2d: Received a 3D input to dropout2d and assuming that channel-wise 1D dropout behavior is desired - input is interpreted as shape (N, C, L), where C is the channel dim. This behavior will change in a future release to interpret the input as one without a batch dimension, i.e. shape (C, H, W). To maintain the 1D channel-wise dropout behavior, please switch to using dropout1d instead.
warnings.warn("dropout2d: Received a 3D input to dropout2d and assuming that channel-wise "
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================ 2 passed, 42 warnings in 4.99s ================================================================ Should I do anything regarding these warnings? |
Hey @Ali-12122 I think everything looks good now to merge! Thanks a lot for the PR and apologies for any inconveniences :) Cheers! |
@hmahmood24 Thanks for everything and thanks for being an amazing guide and support, Cheers to you as well! |
close #15394