Closed knok closed 5 years ago
Thank you for your report and reproducible source. I could reproduce the errors. The error says a node Mul_0
is set input v476
, but the v476
is not found.
The error comes from the below code.
https://github.com/pfnet-research/chainer-stylegan/blob/master/src/stylegan/net.py#L78-L79
v476
seems to be noise
variable. noise
is made within NoiseBlock
and weak reference of noise
is lost outside then noise
= v476
is not found on exporting. Such a temporary variable is supported partially with #202 , but the PR only handles FunctionNode
. In this case, the temporary value noise
is for self.b
(Scale
) input, this is chainer.Chain
class.
The following NoiseBlock
and _retain
is a hot fix to output ONNX graph.
_retain = []
class NoiseBlock(chainer.Chain):
def __init__(self, ch):
# ...(snip)
def get_noise(self, batch_size, ch, shape):
# ...(snip)
def __call__(self, h):
batch_size = h.shape[0]
noise = self.get_noise(batch_size, self.ch, h.shape[2:])
noise = chainer.Variable(noise) # as variable, see issue #216
_retain.append(noise) # to keep reference
h = h + self.b(noise)
return h
Please attention that this patching is not perfect because values of noise
are fixed, not "true" noise. If you want to output get_noise
as ONNX graph, you need to replace the method to chainer.functions
, but current ONNX-Chainer does not support RandomNormal
.
fixed by #221
I tried to export chainer-stylegan generator, but not work.
code: https://gist.github.com/knok/5b240ac74a901ad16344758bb6b90fd2 (place it to src/stylegan, put pretraind model in current directory)
The actutal error is the following: Stack trace:
I don't know where is the node in the source code. Is the problem is needless computation node?