This repository was 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.7k
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
block.export bug #17981
Copy link
Copy link
Open
Description
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
/home/xxxxx/dev/mx/python/mxnet/gluon/block.py:698: UserWarning: Parameter conv3_weight, conv3_bias is not used by any computation. Is this intended?
out = self.forward(*args)
Traceback (most recent call last):
File "/home/xxxxx/dev/U-Net/linux_scripts/little_test.py", line 39, in <module>
net.export('bar')
File "/home/xxxxx/dev/mx/python/mxnet/gluon/block.py", line 1274, in export
assert name in aux_names
AssertionError To Reproduce
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
class Foo(nn.HybridBlock):
def __init__(self):
super(Foo, self).__init__()
self.conv0 = nn.Conv2D(4, 1)
self.conv1 = nn.Conv2D(6, 1)
def hybrid_forward(self, F, x):
x = self.conv0(x)
y = self.conv1(x)
return tuple([x,y])
foo = Foo()
foo.collect_params().initialize()
x = mx.nd.random.uniform(shape=(1,3,64,64))
y = foo(x)
foo.save_parameters('foo.params')
class Bar(nn.HybridBlock):
def __init__(self):
super(Bar, self).__init__()
self.foo = Foo()
self.foo.load_parameters('foo.params')
def hybrid_forward(self, F, x):
return self.foo(x)[0]
net = Bar()
net.hybridize()
x = mx.nd.random.uniform(shape=(1,3,64,64))
y = net(x)
net.export('bar')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:
curl --retry 10 -s https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | python
# paste outputs here
wkcn