Skip to main content

Chainer from/to NNOIR Converter

Project description


Chainer Model from/to NNOIR converter

ATTENTION: This library goes into the maintenance phase too.


pip install nnoir-chainer


Import NNOIR

import chainer
from nnoir_chainer import NNOIRFunction
m = NNOIRFunction('nnoir_file_path')
x = chainer.Variable(np_array)
with chainer.using_config('train', False):
    y = m(x)

Export NNOIR

m = model.CNN()
chainer.serializers.load_npz('cnn.model', L.Classifier(m))
with chainer.using_config('train', False):
    x = chainer.Variable(np.zeros((1, 28*28)).astype(np.float32))
    y = m(x)
    g = nnoir_chainer.Graph(m, (x,), (y,))
    result = g.to_nnoir()
    with open('model.nnoir', 'w') as f:

These layers are supported by nnoir-chainer exporter.

  • chainer.links
    • BatchNormalization
    • Bias
    • Linear
    • Convolution2D (DepthwiseConvolution2D, DilatedConvolution2D)
    • Scale
    • Swish
  • chainer.function
    • Add
    • AddConstant
    • AveragePooling2D
    • ClippedReLU
    • Concat
    • Dropout
    • ELU
    • LeakyReLU
    • MaxPooling2D
    • Mul
    • MulConstant
    • Pad
    • ReLU
    • Reshape
    • Sigmoid
    • Softmax
    • Sub
    • Sum
    • Tanh
    • Transpose
    • Unpooling2D

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nnoir-chainer, version 1.1.3
Filename, size File type Python version Upload date Hashes
Filename, size nnoir_chainer-1.1.3-py3.7.egg (145.2 kB) File type Egg Python version 3.7 Upload date Hashes View
Filename, size nnoir_chainer-1.1.3-py3-none-any.whl (57.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nnoir-chainer-1.1.3.tar.gz (17.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page