Skip to content

Commit

Permalink
Explicit opt_einsum.contract import for linear.py (pytorch#658)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#658

`opt_einsum` package contains ambiguous imports. It has submodule `opt_einsum/contract.py` and at the same time has the following in `__init__.py`:
```
from .contract import contract
```

So normally `from opt_einsum import contract` should import the method not the module. Howeve, some build systems get confused.

This change removes ambiguity and shouldn't affect behaviour in any way

Differential Revision: D60134455
  • Loading branch information
HuanyuZhang authored and facebook-github-bot committed Jul 24, 2024
1 parent 218b681 commit 9b1599a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opacus/grad_sample/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import torch
import torch.nn as nn
from opt_einsum import contract
from opt_einsum.contract import contract

from .utils import register_grad_sampler, register_norm_sampler

Expand Down

0 comments on commit 9b1599a

Please sign in to comment.