ChainerConverter

class webdnn.frontend.chainer.ChainerConverter[source]

Converter for Chainer.

Currently, from v1.23 to v4.0.0 is supported.

convert(inputs, outputs)[source]

Convert chainer computational graph into WebDNN IR.

Parameters:
  • inputs (list of chainer.Variable) – input chainer variables
  • outputs (list of chainer.Variable) – output chainer variables

example

Convert pre-trained ResNet model

model = chainer.links.model.vision.resnet.ResNet50Layers()

# Forward propagation with dummy input to build computational graph
x = chainer.Variable(np.empty((1, 3, 224, 224), dtype=np.float32))
y = model(x, layers=["fc6"])["fc6"]

graph = ChainerConverter().convert([x], [y])
Returns:WebDNN Graph
Return type:(Graph)
convert_from_inout_vars(inputs, output)[source]

Construct computational graph from input and output chainer variables, and convert the graph into WebDNN IR.

Parameters:
  • inputs (list of chainer.Variable) – input chainer variables
  • outputs (list of chainer.Variable) – output chainer variables

Warning

This method will be removed in the future version. Use convert(inputs, outputs)().

Returns:WebDNN Graph
Return type:(Graph)