Skip to content
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

Modify round to support tracing #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maulikmadhavi
Copy link

Upon calling model tracing:

from ofa.model_zoo import ofa_net

ofa_network = ofa_net("ofa_mbv3_d234_e346_k357_w1.0", pretrained=True)
traced_model = torch.jit.trace(ofa_network, torch.randn(1, 3, 224, 224))

I run into the following error:

once-for-all/ofa/imagenet_classification/elastic_nn/modules/dynamic_layers.py in forward(self, x)
    225         if self.inverted_bottleneck is not None:
    226             self.inverted_bottleneck.conv.active_out_channel = make_divisible(
--> 227                 round(in_channel * self.active_expand_ratio),
    228                 MyNetwork.CHANNEL_DIVISIBLE,
    229             )

TypeError: type Tensor doesn't define __round__ method

I replaced round with torch.round.

Thanks
Maulik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant