This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
block.export bug #17981
Comments
I can reproduce the error. |
@chinakook Thanks for reporting this. I just simplified the example as follows. The root cause is that import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
mx.npx.set_np()
class Foo(nn.HybridBlock):
def __init__(self):
super(Foo, self).__init__()
self.conv0 = nn.Conv2D(4, 1, in_channels=3)
self.conv1 = nn.Conv2D(6, 1, in_channels=4)
def hybrid_forward(self, F, x):
x = self.conv0(x)
y = self.conv1(x)
return tuple([x,y])
class Bar(nn.HybridBlock):
def __init__(self):
super(Bar, self).__init__()
with self.name_scope():
self.foo = Foo()
def hybrid_forward(self, F, x):
return self.foo(x)[0]
net = Bar()
net.hybridize()
net.initialize()
x = mx.np.random.uniform(0, 1, (1,3,64,64))
y = net(x)
print(y)
net.export('bar') Error:
|
@sxjscience I made a fix as #17970. It may be ugly, but it works fine for me. It would be appreciated if you have better solution. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
net.hybridize may optimize out some ops. These ops are alive in nn.Block(also nn.HybridBlock), but its names are not contained in symbol's arg_names list. So ignore these ops except that their name are end with 'running_mean' or 'running_var'.
To fix this, please refer to #17970
Error Message
To Reproduce
Steps to reproduce
(Paste the commands you ran that produced the error.)
What have you tried to solve it?
Environment
We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:
The text was updated successfully, but these errors were encountered: