pycasx.tools.NNet.converters.onnx_to_nnet

Convert onnx to NNet.

The file was adapted from <https://github.com/sisl/NNet>. The original file was licensed under MIT License. The original license is included below.

The MIT License (MIT)

Copyright (c) 2018 Stanford Intelligent Systems Laboratory

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Module Contents

Functions

add(input_name, graph, biases, node)

matmul(input_name, graph, weights, node)

relu(node)

onnx_to_nnet_helper(graph, input_name, output_name)

onnx_to_nnet(onnx_file[, input_mins, input_maxes, ...])

Write a .nnet file from an onnx file

main()

pycasx.tools.NNet.converters.onnx_to_nnet.add(input_name, graph, biases, node)
pycasx.tools.NNet.converters.onnx_to_nnet.matmul(input_name, graph, weights, node)
pycasx.tools.NNet.converters.onnx_to_nnet.relu(node)
pycasx.tools.NNet.converters.onnx_to_nnet.onnx_to_nnet_helper(graph, input_name, output_name)
pycasx.tools.NNet.converters.onnx_to_nnet.onnx_to_nnet(onnx_file, input_mins=None, input_maxes=None, means=None, ranges=None, nnet_file='', input_name='', output_name='')

Write a .nnet file from an onnx file :param onnx_file: (string) Path to onnx file :param input_mins: (list) optional, Minimum values for each neural

network input.

Parameters:
  • input_maxes – (list) optional, Maximum values for each neural network output.

  • means – (list) optional, Mean value for each input and value for mean of all outputs, used for normalization

  • ranges – (list) optional, Range value for each input and value for range of all outputs, used for normalization

  • input_name – (string) optional, Name of operation corresponding to input.

  • output_name – (string) optional, Name of operation corresponding to output.

pycasx.tools.NNet.converters.onnx_to_nnet.main()
Return type:

None