Skip to content

Request: detecting unnecessary torch.no_grad #97

Open
@jamesbraza

Description

@jamesbraza

It would be nice for TorchFix to flag when no_grad is used both as a decorator and a context manager in the same function:

import torch

@torch.no_grad
def some_func():
    with torch.no_grad():  # Redundant to decorator
        ...

Same thing applies for torch.inference_mode.

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