Skip to content

aten::rrelu_with_noise function mutates noise parameter #82434

@ttanpcs

Description

@ttanpcs

🐛 Describe the bug

class TestMode(TorchDispatchMode):
        def __torch_dispatch__(self, func, types, args=(), kwargs=None):
                print(func._schema.name)
                print(args)
                out = func(*args, **kwargs)
                print(args)
                return out

a = torch.rand((3,3))
with enable_torch_dispatch_mode(TestMode()):
        torch.nn.functional.rrelu(a, training=True)

returns
aten::empty_like
(tensor([[0.0290, 0.4019, 0.2598],
[0.3666, 0.0583, 0.7006],
[0.0518, 0.4681, 0.6738]]),)
(tensor([[0.0290, 0.4019, 0.2598],
[0.3666, 0.0583, 0.7006],
[0.0518, 0.4681, 0.6738]]),)
aten::rrelu_with_noise
(tensor([[0.0290, 0.4019, 0.2598],
[0.3666, 0.0583, 0.7006],
[0.0518, 0.4681, 0.6738]]), tensor([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]]), 0.125, 0.3333333333333333, True)
(tensor([[0.0290, 0.4019, 0.2598],
[0.3666, 0.0583, 0.7006],
[0.0518, 0.4681, 0.6738]]), tensor([[1., 1., 1.],
[1., 1., 1.],
[1., 1., 1.]]), 0.125, 0.3333333333333333, True)

^ Where the noise parameter mutates before and after aten::rrelu_with_noise. However the function schema in native_functions.yaml doesn't specify that the noise parameter is mutable.

Versions

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions