Showing preview only (2,083K chars total). Download the full file or copy to clipboard to get everything.
Repository: KhronosGroup/NNEF-Tools
Branch: main
Commit: 6ca6fd2a0e3c
Files: 269
Total size: 1.9 MB
Directory structure:
gitextract_brhyl024/
├── .github/
│ └── workflows/
│ ├── build_nnef.yml
│ └── build_nnef_tools.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── README.md
├── _config.yml
├── fix_nnef_binary_size.py
├── models/
│ └── README.md
├── nnef-pyproject/
│ ├── README.md
│ ├── cpp_api.md
│ ├── examples/
│ │ ├── alexnet.txt
│ │ ├── googlenet.txt
│ │ ├── resnet.txt
│ │ ├── samples/
│ │ │ ├── sample.py
│ │ │ ├── sample_ext.py
│ │ │ └── sample_gen.py
│ │ └── vgg.txt
│ ├── nnef/
│ │ ├── __init__.py
│ │ ├── binary.py
│ │ ├── cpp/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── include/
│ │ │ │ ├── cnnef.h
│ │ │ │ ├── nnef/
│ │ │ │ │ ├── common/
│ │ │ │ │ │ ├── binary.h
│ │ │ │ │ │ ├── dictionary.h
│ │ │ │ │ │ ├── error.h
│ │ │ │ │ │ ├── lexer.h
│ │ │ │ │ │ ├── parser.h
│ │ │ │ │ │ ├── prototype.h
│ │ │ │ │ │ ├── shapes.h
│ │ │ │ │ │ ├── typespec.h
│ │ │ │ │ │ ├── typeutils.h
│ │ │ │ │ │ └── value.h
│ │ │ │ │ ├── comp/
│ │ │ │ │ │ ├── comp_parser.h
│ │ │ │ │ │ ├── evaluation.h
│ │ │ │ │ │ ├── expression.h
│ │ │ │ │ │ ├── fragment.h
│ │ │ │ │ │ └── stdlib_source.h
│ │ │ │ │ ├── flat/
│ │ │ │ │ │ ├── flat_parser.h
│ │ │ │ │ │ ├── quant_parser.h
│ │ │ │ │ │ └── stdlib_protos.h
│ │ │ │ │ └── runtime/
│ │ │ │ │ ├── execution.h
│ │ │ │ │ ├── ndrange.h
│ │ │ │ │ └── operations.h
│ │ │ │ └── nnef.h
│ │ │ ├── infer.cpp
│ │ │ ├── sample.cpp
│ │ │ └── src/
│ │ │ ├── cnnef.cpp
│ │ │ └── nnef.cpp
│ │ ├── nnef.cpp
│ │ ├── parser.py
│ │ ├── printer.py
│ │ ├── shapes.py
│ │ └── validate.py
│ ├── package_info.md
│ ├── pyproject.toml
│ ├── setup.py
│ ├── stdlib.nnef
│ └── tests/
│ └── test.py
└── nnef_tools-pyproject/
├── LICENSE
├── README.md
├── custom/
│ ├── composite_export_example.py
│ ├── custom_operators_example.py
│ ├── custom_optimizers_example.py
│ ├── custom_transforms_example.py
│ ├── onnx_custom_export_example.py
│ └── onnx_custom_transforms_example.py
├── nnef_tools/
│ ├── __init__.py
│ ├── conversion/
│ │ ├── __init__.py
│ │ ├── converter.py
│ │ ├── nnef_to_onnx.py
│ │ ├── nnef_to_tf.py
│ │ ├── nnef_to_tflite.py
│ │ ├── onnx_to_nnef.py
│ │ ├── tf_to_nnef.py
│ │ └── tflite_to_nnef.py
│ ├── convert.py
│ ├── execute.py
│ ├── execution/
│ │ ├── __init__.py
│ │ └── tvm/
│ │ ├── __init__.py
│ │ └── nnef_frontend/
│ │ ├── __init__.py
│ │ ├── relax/
│ │ │ ├── __init__.py
│ │ │ ├── nnef_frontend.py
│ │ │ └── nnef_ops.py
│ │ └── relay/
│ │ ├── __init__.py
│ │ ├── from_nnef.py
│ │ └── nnef_ops.py
│ ├── generate.py
│ ├── gmac.py
│ ├── image_tensor.py
│ ├── interpreter/
│ │ ├── __init__.py
│ │ └── pytorch/
│ │ ├── __init__.py
│ │ ├── nnef_module.py
│ │ └── nnef_operators.py
│ ├── io/
│ │ ├── __init__.py
│ │ ├── caffe2/
│ │ │ ├── __init__.py
│ │ │ ├── caffe/
│ │ │ │ ├── __init__.py
│ │ │ │ └── proto/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── caffe.proto
│ │ │ │ └── caffe_pb2.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ ├── nnef/
│ │ │ ├── __init__.py
│ │ │ ├── helpers.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ ├── onnx/
│ │ │ ├── __init__.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ └── tf/
│ │ ├── __init__.py
│ │ ├── graphdef/
│ │ │ ├── __init__.py
│ │ │ ├── composite.py
│ │ │ ├── protobuf.py
│ │ │ ├── reader.py
│ │ │ ├── utils.py
│ │ │ └── writer.py
│ │ └── lite/
│ │ ├── __init__.py
│ │ ├── flatbuffers/
│ │ │ ├── AbsOptions.py
│ │ │ ├── ActivationFunctionType.py
│ │ │ ├── AddNOptions.py
│ │ │ ├── AddOptions.py
│ │ │ ├── ArgMaxOptions.py
│ │ │ ├── ArgMinOptions.py
│ │ │ ├── BatchMatMulOptions.py
│ │ │ ├── BatchToSpaceNDOptions.py
│ │ │ ├── BidirectionalSequenceLSTMOptions.py
│ │ │ ├── BidirectionalSequenceRNNOptions.py
│ │ │ ├── Buffer.py
│ │ │ ├── BuiltinOperator.py
│ │ │ ├── BuiltinOptions.py
│ │ │ ├── CallOptions.py
│ │ │ ├── CastOptions.py
│ │ │ ├── CombinerType.py
│ │ │ ├── ConcatEmbeddingsOptions.py
│ │ │ ├── ConcatenationOptions.py
│ │ │ ├── Conv2DOptions.py
│ │ │ ├── CosOptions.py
│ │ │ ├── CustomOptionsFormat.py
│ │ │ ├── CustomQuantization.py
│ │ │ ├── DensifyOptions.py
│ │ │ ├── DepthToSpaceOptions.py
│ │ │ ├── DepthwiseConv2DOptions.py
│ │ │ ├── DequantizeOptions.py
│ │ │ ├── DimensionMetadata.py
│ │ │ ├── DimensionType.py
│ │ │ ├── DivOptions.py
│ │ │ ├── EmbeddingLookupSparseOptions.py
│ │ │ ├── EqualOptions.py
│ │ │ ├── ExpOptions.py
│ │ │ ├── ExpandDimsOptions.py
│ │ │ ├── FakeQuantOptions.py
│ │ │ ├── FillOptions.py
│ │ │ ├── FloorDivOptions.py
│ │ │ ├── FloorModOptions.py
│ │ │ ├── FullyConnectedOptions.py
│ │ │ ├── FullyConnectedOptionsWeightsFormat.py
│ │ │ ├── GatherNdOptions.py
│ │ │ ├── GatherOptions.py
│ │ │ ├── GreaterEqualOptions.py
│ │ │ ├── GreaterOptions.py
│ │ │ ├── HardSwishOptions.py
│ │ │ ├── IfOptions.py
│ │ │ ├── Int32Vector.py
│ │ │ ├── L2NormOptions.py
│ │ │ ├── LSHProjectionOptions.py
│ │ │ ├── LSHProjectionType.py
│ │ │ ├── LSTMKernelType.py
│ │ │ ├── LSTMOptions.py
│ │ │ ├── LeakyReluOptions.py
│ │ │ ├── LessEqualOptions.py
│ │ │ ├── LessOptions.py
│ │ │ ├── LocalResponseNormalizationOptions.py
│ │ │ ├── LogSoftmaxOptions.py
│ │ │ ├── LogicalAndOptions.py
│ │ │ ├── LogicalNotOptions.py
│ │ │ ├── LogicalOrOptions.py
│ │ │ ├── MatrixDiagOptions.py
│ │ │ ├── MatrixSetDiagOptions.py
│ │ │ ├── MaximumMinimumOptions.py
│ │ │ ├── Metadata.py
│ │ │ ├── MirrorPadMode.py
│ │ │ ├── MirrorPadOptions.py
│ │ │ ├── Model.py
│ │ │ ├── MulOptions.py
│ │ │ ├── NegOptions.py
│ │ │ ├── NonMaxSuppressionV4Options.py
│ │ │ ├── NonMaxSuppressionV5Options.py
│ │ │ ├── NotEqualOptions.py
│ │ │ ├── OneHotOptions.py
│ │ │ ├── Operator.py
│ │ │ ├── OperatorCode.py
│ │ │ ├── PackOptions.py
│ │ │ ├── PadOptions.py
│ │ │ ├── PadV2Options.py
│ │ │ ├── Padding.py
│ │ │ ├── Pool2DOptions.py
│ │ │ ├── PowOptions.py
│ │ │ ├── QuantizationDetails.py
│ │ │ ├── QuantizationParameters.py
│ │ │ ├── QuantizeOptions.py
│ │ │ ├── RNNOptions.py
│ │ │ ├── RangeOptions.py
│ │ │ ├── RankOptions.py
│ │ │ ├── ReducerOptions.py
│ │ │ ├── ReshapeOptions.py
│ │ │ ├── ResizeBilinearOptions.py
│ │ │ ├── ResizeNearestNeighborOptions.py
│ │ │ ├── ReverseSequenceOptions.py
│ │ │ ├── ReverseV2Options.py
│ │ │ ├── SVDFOptions.py
│ │ │ ├── ScatterNdOptions.py
│ │ │ ├── SegmentSumOptions.py
│ │ │ ├── SelectOptions.py
│ │ │ ├── SelectV2Options.py
│ │ │ ├── SequenceRNNOptions.py
│ │ │ ├── ShapeOptions.py
│ │ │ ├── SkipGramOptions.py
│ │ │ ├── SliceOptions.py
│ │ │ ├── SoftmaxOptions.py
│ │ │ ├── SpaceToBatchNDOptions.py
│ │ │ ├── SpaceToDepthOptions.py
│ │ │ ├── SparseIndexVector.py
│ │ │ ├── SparseToDenseOptions.py
│ │ │ ├── SparsityParameters.py
│ │ │ ├── SplitOptions.py
│ │ │ ├── SplitVOptions.py
│ │ │ ├── SquareOptions.py
│ │ │ ├── SquaredDifferenceOptions.py
│ │ │ ├── SqueezeOptions.py
│ │ │ ├── StridedSliceOptions.py
│ │ │ ├── SubGraph.py
│ │ │ ├── SubOptions.py
│ │ │ ├── Tensor.py
│ │ │ ├── TensorType.py
│ │ │ ├── TileOptions.py
│ │ │ ├── TopKV2Options.py
│ │ │ ├── TransposeConvOptions.py
│ │ │ ├── TransposeOptions.py
│ │ │ ├── Uint16Vector.py
│ │ │ ├── Uint8Vector.py
│ │ │ ├── UnidirectionalSequenceLSTMOptions.py
│ │ │ ├── UniqueOptions.py
│ │ │ ├── UnpackOptions.py
│ │ │ ├── WhereOptions.py
│ │ │ ├── WhileOptions.py
│ │ │ ├── ZerosLikeOptions.py
│ │ │ ├── __init__.py
│ │ │ └── schema.fbs
│ │ ├── helpers.py
│ │ ├── reader.py
│ │ └── writer.py
│ ├── model/
│ │ ├── __init__.py
│ │ ├── graph.py
│ │ └── utils.py
│ ├── operation_mapping.md
│ ├── optimization/
│ │ ├── __init__.py
│ │ ├── nnef_optimizer.py
│ │ ├── onnx_optimizer.py
│ │ ├── tf_optimizer.py
│ │ └── tflite_optimizer.py
│ ├── quantize.py
│ ├── random_tensor.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── stdio.py
│ │ └── types.py
│ └── visualize.py
├── package_info.md
├── pyproject.toml
└── tests/
└── conversion/
├── graphdef_test.py
├── onnx_test.py
└── tflite_test.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/build_nnef.yml
================================================
name: Build, test and publish nnef
on:
push:
tags:
- 'nnef-v[0-9]+.[0-9]+.[0-9]+'
jobs:
build_wheels:
name: Build nnef wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
- macos-14
steps:
- uses: actions/checkout@v4
- name: Build wheels for nnef
uses: pypa/cibuildwheel@v3.4.0
with:
package-dir: nnef-pyproject
output-dir: dist/
config-file: nnef-pyproject/pyproject.toml
env:
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ github.ref_name }}
path: ./dist/*.whl
build_sdist:
name: Build nnef sdist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build ./nnef-pyproject/ --sdist --outdir ./dist
- uses: actions/upload-artifact@v4
with:
name: dist-${{ github.ref_name }}
path: ./dist/*.tar.gz
publish:
name: Publish nnef
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- name: Download dist/
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
================================================
FILE: .github/workflows/build_nnef_tools.yml
================================================
name: Build, test and publish nnef_tools
on:
push:
tags:
- 'nnef_tools-v[0-9]+.[0-9]+.[0-9]+'
jobs:
build_nnef_tools:
name: Build and publish nnef_tools
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build pytest pytest-xdist
- name: Build package
run: python -m build ./nnef_tools-pyproject/ --outdir ./dist/
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.ref_name }}
path: ./dist/*
- name: Install
run: python -m pip install ./nnef-pyproject/ ./nnef_tools-pyproject[full]
- name: Test
run: python -m pytest ./nnef_tools-pyproject/tests/ -n auto
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
================================================
FILE: .gitignore
================================================
*.pyc
__pycache__
.idea
/_models
/out
/*/build
/*/dist
*.egg-info
================================================
FILE: CODE_OF_CONDUCT.md
================================================
A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil.
================================================
FILE: README.md
================================================
[](https://opensource.org/licenses/Apache-2.0)
<p align="center"><img src="https://www.khronos.org/images/jcogs_img/cache/nnef_500px_apr17_-_28de80_-_3c2b17797282ce265889b88b2035b24403f2d049.png" /></p>
**Development of the latest tools related to version 2.0 of the NNEF specification draft can be found on branch [v2.0](https://github.com/KhronosGroup/NNEF-Tools/tree/v2.0).**
# NNEF-Tools
NNEF reduces machine learning deployment fragmentation by enabling a rich mix of neural network training tools and inference engines to be used by applications across a diverse range of devices and platforms.
This repository contains tools to generate and consume NNEF documents, such as a parser (C++ and Python) that can be included in consumer applications and converters for deep learning frameworks.
* [NNEF Model Zoo](models#nnef-model-zoo)
* [NNEF Tools](nnef_tools-pyproject#nnef-tools)
* [NNEF Parser](nnef-pyproject#nnef-parser---repository)
## NNEF Model Zoo
A **Model Zoo** is now available; the 'models' folder contains a variety of [NNEF models](models#nnef-model-zoo) converted from various sources.
## NNEF Tools
[NNEF Tools](nnef_tools-pyproject#nnef-tools) folder contains tools to convert pre-trained models in `tensorFlow`/`caffe`/`caffe2`/`ONNX` to NNEF format.
## NNEF Parser
[NNEF Parser](nnef-pyproject#nnef-parser---repository) folder contains `C++` and `Python` source code for a sample NNEF graph parser.
## Release Notes
### Added new operators in spec version 1.0.4 (06.15.2021)
Following the update of the NNEF specification to version 1.0.4, conversion for the corresponding operators has been added. Furthermore, error handling of non-convertible models has been greately enhanced with error messages detailing the exact cause of failure listed for all non-convertible operations before conversion is started.
### Reworked NNEF Tools (10.21.2020)
The tools for converting models to NNEF and transforming NNEF models has been thoroughly reworked to make them more robust and unified and easier to maintain. The basic functionality of the main scripts has been kept, however their parameterization has been simplified and unified in some places; please refer to the readme and the help (`-h` option) of the respective scripts for more details. The scripts cover the following major areas of functionality: model conversion, optimization, execution and visualization. A GMAC calculator is also provide, and further utility scripts may be added in the future.
### Change in quantization information in binary files (06.12.2020)
According to the change in version 1.0.3 of the NNEF specification, quantization algorithm information has been deprecated in the tensor binary file format. The tensor binary only stores the item-type of the tensor data, and the binary reader does not return quantization information (also used to be called 'compression' info). Furthermore, the mapping between stored item-types and data-types in the structural description has been clarified, so that the reader of a tensor binary can tell what the data-type of the read tensor is. This enhances the reader as it can now properly map the binary data to C++ or Python numpy types upon reading. The C++ code has been updated to perform such a mapping, and is now able to return a typed array instead of just plain bytes.
### Change in shape inference compared to previous version (04.10.2019)
According to a change in version 1.0.1 of the NNEF specification, the `shape_of` operator in NNEF syntax is deprecated, and the parser does not support it. This enables the decoupling of parsing from shape inference, allowing parsing to succeed even if shape information is not available for all operations, such as custom defined operations before the graph definition. Shape inference can still be run after training, furthermore it can be customized (via function pointers) for custom defined operations.
### TENSOR BINARY BUG FIX (10.19.2018)
There was a bug in the Python code that reads/writes the tensor binary files (the header contained 4 extra padding bytes therefore not conforming to the spec). The code has been updated to read/write and _check_ the proper header size. As a consequence, any files written out with the code that contained the bug cannot be read back with the updated code. To aid the usage of such existing files, a script was created called `fix_nnef_binary_size.py` that can be used to remove the excess 4 bytes from existing NNEF files. The script is located in the root folder of this repo, it has no dependencies (not even the NNEF parser). It can be run on the main folder of an NNEF model, and it fixes all binary files in the folder. In case one runs it on an NNEF model that does not contain the bug, it does nothing. It can be used as follows:
```
python fix_nnef_binary_size.py my_nnef_model_folder
```
Such an invocation fixes the files in place. Optionally, a second argument can be supplied to the script to write the fixed files to a different output path. In this case, the script copies all non-binary files (such as graph.nnef) to the target folder, so the resulting folder contains the whole valid model.
================================================
FILE: _config.yml
================================================
theme: jekyll-theme-slate
================================================
FILE: fix_nnef_binary_size.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
import struct
def fix_nnef_binary(in_fn, out_fn):
header_size = 128
with open(in_fn, 'rb') as file:
file_size = os.fstat(file.fileno()).st_size
header = file.read(header_size)
excess = file.read(4)
data = file.read()
[magic1, magic2, major, minor] = bytearray(header[:4])
if magic1 != 0x4E or magic2 != 0xEF or major != 1 or minor != 0:
return False
data_length, = struct.unpack('i', header[4:8])
if file_size != header_size + data_length + 4:
return False
with open(out_fn, 'wb') as file:
file.write(header)
file.write(data)
return True
def fix_nnef_binaries(in_path, out_path):
for root, dirs, files in os.walk(in_path):
for filename in files:
if not filename.startswith('.'):
in_fn = os.path.join(root, filename)
out_fn = os.path.join(out_path, os.path.relpath(in_fn, in_path))
if os.path.splitext(filename)[1] == '.dat':
if fix_nnef_binary(in_fn, out_fn):
print('Fixed file: ' + in_fn)
elif out_fn != in_fn:
with open(in_fn, 'rb') as in_file, open(out_fn, 'wb') as out_file:
out_file.write(in_file.read())
if __name__ == "__main__":
if len(sys.argv) < 2:
print('input path must be provided')
exit(-1)
elif len(sys.argv) > 3:
print('too many arguments provided')
exit(-1)
fix_nnef_binaries(in_path=sys.argv[1], out_path=sys.argv[2] if len(sys.argv) == 3 else sys.argv[1])
================================================
FILE: models/README.md
================================================
NNEF model zoo
==============
The following collection of models were compiled by running the converter tools in this repository on publicly available models. Each entry provides a link to the original and the converted model.
* TensorFlow models have been acquired from [https://www.tensorflow.org/lite/guide/hosted_models]
* ONNX models have been acquired from [https://github.com/onnx/models]
* Caffe models have been acquired from [https://github.com/BVLC/caffe/wiki/Model-Zoo]
* Caffe2 models have been acquired from [https://github.com/caffe2/models]
AlexNet
-------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
BVLC AlexNet | 244 Mb | [Caffe](https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/bvlc_alexnet.caffemodel.nnef.tgz)
BVLC AlexNet | 244 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/bvlc_alexnet.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/bvlc_alexnet.onnx.nnef.tgz)
VGG
---
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
VGG-16 | 553.6 MB Mb | [Caffe](https://gist.github.com/ksimonyan/211839e770f7b538e2d8) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/vgg16.caffemodel.nnef.tgz)
VGG-19 | 574.8 MB Mb | [Caffe](https://gist.github.com/ksimonyan/3785162f95cd2d5fee77) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/vgg19.caffemodel.nnef.tgz)
VGG-16 | 527.8 MB Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/vgg/vgg16/vgg16.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/vgg16.onnx.nnef.tgz)
VGG-19 | 548.1 MB Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/vgg/vgg19/vgg19.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/vgg19.onnx.nnef.tgz)
GoogleNet
---------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
Inception v1 | 28 Mb | [Caffe2](https://github.com/caffe2/models/tree/master/inception_v1) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v1.caffe2.nnef.tgz)
Inception v1 | 28 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/inception_v1.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v1.onnx.nnef.tgz)
Inception v2 | 45 Mb | [Caffe2](https://github.com/caffe2/models/tree/master/inception_v2) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v2.caffe2.nnef.tgz)
Inception v2 | 45 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/inception_v2.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v2.onnx.nnef.tgz)
Inception v3 | 95.3 Mb | [TensorFlow](https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/inception_v3_2018_04_27.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v3.tfpb.nnef.tgz)
Inception v4 | 170.7 Mb | [TensorFlow](https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/inception_v4_2018_04_27.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v4.tfpb.nnef.tgz)
BVLC GoogleNet | 28 Mb | [Caffe](https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/bvlc_googlenet.caffemodel.nnef.tgz)
BVLC GoogleNet | 28 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/bvlc_googlenet.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/bvlc_googlenet.onnx.nnef.tgz)
_Quantized models_
Name | Size | Original | Converted
--- | --- | --- | ---
Inception v1 | 6.4 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/inception_v1_224_quant_20181026.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v1_quant.tflite.nnef.tgz)
Inception v2 | 11 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/inception_v2_224_quant_20181026.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v2_quant.tflite.nnef.tgz)
Inception v3 | 23 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/tflite_11_05_08/inception_v3_quant.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v3_quant.tflite.nnef.tgz)
Inception v4 | 41 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/inception_v4_299_quant_20181026.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_v4_quant.tflite.nnef.tgz)
ResNet
------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
Resnet v1-18 | 44.7 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v1/resnet18v1.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v1_18.onnx.nnef.tgz)
Resnet v1-34 | 83.3 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet34v1/resnet34v1.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v1_34.onnx.nnef.tgz)
Resnet v1-50 | 97.8 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet50v1/resnet50v1.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v1_50.onnx.nnef.tgz)
Resnet v1-101 | 170.6 MB Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet101v1/resnet101v1.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v1_101.onnx.nnef.tgz)
Resnet v1-152 | 242.3 Mb | [Caffe](https://github.com/KaimingHe/deep-residual-networks) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v1_152.caffemodel.nnef.tgz)
Resnet v2-18 | 44.6 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v2/resnet18v2.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v2_18.onnx.nnef.tgz)
Resnet v2-34 | 83.2 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet34v2/resnet34v2.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v2_34.onnx.nnef.tgz)
Resnet v2-50 | 97.7 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet50v2/resnet50v2.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v2_50.onnx.nnef.tgz)
Resnet v2-101 | 170.4 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet101v2/resnet101v2.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/resnet_v2_101.onnx.nnef.tgz)
Inception-Resnet v2 | 121 Mb | [TensorFlow](https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/inception_resnet_v2_2018_04_27.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/inception_resnet_v2.tfpb.nnef.tgz)
MobileNet
---------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
MobileNet v1-1.0 | 16.9 Mb | [TensorFlow](http://download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v1_1.0.tfpb.nnef.tgz)
MobileNet v1-1.0 | 17.2 Mb | [Caffe](https://github.com/shicai/MobileNet-Caffe) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v1_1.0.caffemodel.nnef.tgz)
MobileNet v2-1.0 | 14.0 Mb | [TensorFlow](http://download.tensorflow.org/models/tflite_11_05_08/mobilenet_v2_1.0_224.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v2_1.0.tfpb.nnef.tgz)
MobileNet v2-1.0 | 14.4 Mb | [Caffe](https://github.com/shicai/MobileNet-Caffe) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v2_1.0.caffemodel.nnef.tgz)
MobileNet v2-1.0 | 13.6 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v2_1.0.onnx.nnef.tgz)
_Quantized models_
Name | Size | Original | Converted
--- | --- | --- | ---
MobileNet v1-1.0 | 4.3 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v1_1.0_quant.tflite.nnef.tgz)
MobileNet v2-1.0 | 3.4 Mb | [TensorFlow-Lite](http://download.tensorflow.org/models/tflite_11_05_08/mobilenet_v2_1.0_224_quant.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/mobilenet_v2_1.0_quant.tflite.nnef.tgz)
SqueezeNet
----------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
SqueezeNet | 5.0 Mb | [TensorFlow](https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/squeezenet_2018_04_27.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/squeezenet.tfpb.nnef.tgz)
SqueezeNet 1.0 | 4.7 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/squeezenet.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/squeezenet_v1.0.onnx.nnef.tgz)
SqueezeNet 1.1 | 4.7 Mb | [ONNX](https://s3.amazonaws.com/onnx-model-zoo/squeezenet/squeezenet1.1/squeezenet1.1.onnx) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/squeezenet_v1.1.onnx.nnef.tgz)
SqueezeNet 1.0 | 4.7 Mb | [Caffe](https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.0) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/squeezenet_v1.0.caffemodel.nnef.tgz)
SqueezeNet 1.1 | 4.7 Mb | [Caffe](https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/squeezenet_v1.1.caffemodel.nnef.tgz)
ShuffleNet
----------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
ShuffleNet | 5.3 Mb | [ONNX](https://s3.amazonaws.com/download.onnx/models/opset_9/shufflenet.tar.gz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/shufflenet.onnx.nnef.tgz)
NASNet
------
_Floating point models_
Name | Size | Original | Converted
--- | --- | --- | ---
NasNet mobile | 21.4 Mb | [TensorFlow](https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/nasnet_mobile_2018_04_27.tgz) | [NNEF](https://sfo2.digitaloceanspaces.com/nnef-public/nasnet_mobile.tfpb.nnef.tgz)
================================================
FILE: nnef-pyproject/README.md
================================================
NNEF Parser - repository
===================
Introduction
------------
The code consists of a C++ library that contains two example parsers (one for
flat and one for compositional NNEF syntax). This library can be used to build tools
that require parsing NNEF files. It requires a C++11 compatible compiler.
The Python code wraps the C++ parser and adds some further utilities to load and save NNEF documents easily. It also contains a script to validate NNEF documents (`validate.py`) and optionally print a lowered version of the graph. If the tool encounters an invalid document, it prints the first error and stops parsing. Type `python validate.py -h` to show the usage help.
C++ Library
-----------
Documentation of the library: [cpp_api.md](cpp_api.md)
Python Package
--------------
Documentation of the Python package: [package_info.md](package_info.md)
================================================
FILE: nnef-pyproject/cpp_api.md
================================================
Building the C++ library
------------------------
The C++ library can be compiled with cmake.
The `examples/samples/sample.cpp` contains a minimal example that showcases the use of the parser.
Example of build commands under Linux:
````
$ cd nnef/cpp
$ mkdir build && cd build
$ cmake ..
$ make
````
Using the C++ library
---------------------
Using the C++ parser is as simple as follows:
```
#include "nnef.h"
nnef::Graph graph;
std::string error;
bool success = nnef::load_graph("path/to/NNEF/folder", graph, error);
```
Upon succeess, the graph structure is filled, while in case of an error, the error string is filled. The fields inside the graph structure, and further parameters to the `load_graph` function are documented in `nnef.h`. After the graph is successfully loaded, shape inference can be performed in a subsequent call if required:
```
success = nnef::infer_shapes(graph, error);
```
Upon success, the shape fields of tensors are filled in.
================================================
FILE: nnef-pyproject/examples/alexnet.txt
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version 1.0;
graph alexnet( input ) -> ( output )
{
input = external(shape = [1, 3, 224, 224]);
kernel1 = variable(shape = [64, 3, 11, 11], label = 'alexnet_v2/conv1/kernel');
bias1 = variable(shape = [1, 64], label = 'alexnet_v2/conv1/bias');
conv1 = conv(input, kernel1, bias1, padding = [(0, 0), (0, 0)], border = 'constant', stride = [4, 4], dilation = [1, 1]);
relu1 = relu(conv1);
pool1 = max_pool(relu1, size = [1, 1, 3, 3], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel2 = variable(shape = [192, 64, 5, 5], label = 'alexnet_v2/conv2/kernel');
bias2 = variable(shape = [1, 192], label = 'alexnet_v2/conv2/bias');
conv2 = conv(pool1, kernel2, bias2, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu2 = relu(conv2);
pool2 = max_pool(relu2, size = [1, 1, 3, 3], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel3 = variable(shape = [384, 192, 3, 3], label = 'alexnet_v2/conv3/kernel');
bias3 = variable(shape = [1, 384], label = 'alexnet_v2/conv3/bias');
conv3 = conv(pool2, kernel3, bias3, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu3 = relu(conv3);
kernel4 = variable(shape = [384, 384, 3, 3], label = 'alexnet_v2/conv4/kernel');
bias4 = variable(shape = [1, 384], label = 'alexnet_v2/conv4/bias');
conv4 = conv(relu3, kernel4, bias4, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu4 = relu(conv4);
kernel5 = variable(shape = [256, 384, 3, 3], label = 'alexnet_v2/conv5/kernel');
bias5 = variable(shape = [1, 256], label = 'alexnet_v2/conv5/bias');
conv5 = conv(relu4, kernel5, bias5, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu5 = relu(conv5);
pool3 = max_pool(relu5, size = [1, 1, 3, 3], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel6 = variable(shape = [4096, 256, 5, 5], label = 'alexnet_v2/fc6/kernel');
bias6 = variable(shape = [1, 4096], label = 'alexnet_v2/fc6/bias');
conv6 = conv(pool3, kernel6, bias6, padding = [(0, 0), (0, 0)], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu6 = relu(conv6);
kernel7 = variable(shape = [4096, 4096, 1, 1], label = 'alexnet_v2/fc7/kernel');
bias7 = variable(shape = [1, 4096], label = 'alexnet_v2/fc7/bias');
conv7 = conv(relu6, kernel7, bias7, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu7 = relu(conv7);
kernel8 = variable(shape = [1000, 4096, 1, 1], label = 'alexnet_v2/fc8/kernel');
bias8 = variable(shape = [1, 1000], label = 'alexnet_v2/fc8/bias');
output = conv(relu7, kernel8, bias8, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
}
================================================
FILE: nnef-pyproject/examples/googlenet.txt
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version 1.0;
graph googlenet( input ) -> ( output )
{
input = external(shape = [1, 3, 224, 224]);
kernel1 = variable(shape = [64, 3, 7, 7], label = 'InceptionV1/Conv2d_1a_7x7/kernel');
bias1 = variable(shape = [1, 64], label = 'InceptionV1/Conv2d_1a_7x7/bias');
conv1 = conv(input, kernel1, bias1, padding = [], border = 'constant', stride = [2, 2], dilation = [1, 1]);
relu1 = relu(conv1);
pool1 = max_pool(relu1, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 2, 2]);
kernel2 = variable(shape = [64, 64, 1, 1], label = 'InceptionV1/Conv2d_2b_1x1/kernel');
bias2 = variable(shape = [1, 64], label = 'InceptionV1/Conv2d_2b_1x1/bias');
conv2 = conv(pool1, kernel2, bias2, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu2 = relu(conv2);
kernel3 = variable(shape = [192, 64, 3, 3], label = 'InceptionV1/Conv2d_2c_3x3/kernel');
bias3 = variable(shape = [1, 192], label = 'InceptionV1/Conv2d_2c_3x3/bias');
conv3 = conv(relu2, kernel3, bias3, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu3 = relu(conv3);
pool2 = max_pool(relu3, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 2, 2]);
kernel4 = variable(shape = [64, 192, 1, 1], label = 'InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/kernel');
bias4 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/bias');
conv4 = conv(pool2, kernel4, bias4, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu4 = relu(conv4);
kernel5 = variable(shape = [96, 192, 1, 1], label = 'InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/kernel');
bias5 = variable(shape = [1, 96], label = 'InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/bias');
conv5 = conv(pool2, kernel5, bias5, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu5 = relu(conv5);
kernel6 = variable(shape = [128, 96, 3, 3], label = 'InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/kernel');
bias6 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/bias');
conv6 = conv(relu5, kernel6, bias6, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu6 = relu(conv6);
kernel7 = variable(shape = [16, 192, 1, 1], label = 'InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/kernel');
bias7 = variable(shape = [1, 16], label = 'InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/bias');
conv7 = conv(pool2, kernel7, bias7, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu7 = relu(conv7);
kernel8 = variable(shape = [32, 16, 3, 3], label = 'InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_3x3/kernel');
bias8 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_3x3/bias');
conv8 = conv(relu7, kernel8, bias8, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu8 = relu(conv8);
pool3 = max_pool(pool2, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel9 = variable(shape = [32, 192, 1, 1], label = 'InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/kernel');
bias9 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/bias');
conv9 = conv(pool3, kernel9, bias9, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu9 = relu(conv9);
concat1 = concat([relu4,relu6,relu8,relu9], axis = 1);
kernel10 = variable(shape = [128, 256, 1, 1], label = 'InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/kernel');
bias10 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/bias');
conv10 = conv(concat1, kernel10, bias10, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu10 = relu(conv10);
kernel11 = variable(shape = [128, 256, 1, 1], label = 'InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/kernel');
bias11 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/bias');
conv11 = conv(concat1, kernel11, bias11, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu11 = relu(conv11);
kernel12 = variable(shape = [192, 128, 3, 3], label = 'InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/kernel');
bias12 = variable(shape = [1, 192], label = 'InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/bias');
conv12 = conv(relu11, kernel12, bias12, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu12 = relu(conv12);
kernel13 = variable(shape = [32, 256, 1, 1], label = 'InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/kernel');
bias13 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/bias');
conv13 = conv(concat1, kernel13, bias13, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu13 = relu(conv13);
kernel14 = variable(shape = [96, 32, 3, 3], label = 'InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_3x3/kernel');
bias14 = variable(shape = [1, 96], label = 'InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_3x3/bias');
conv14 = conv(relu13, kernel14, bias14, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu14 = relu(conv14);
pool4 = max_pool(concat1, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel15 = variable(shape = [64, 256, 1, 1], label = 'InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/kernel');
bias15 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/bias');
conv15 = conv(pool4, kernel15, bias15, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu15 = relu(conv15);
concat2 = concat([relu10,relu12,relu14,relu15], axis = 1);
pool5 = max_pool(concat2, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 2, 2]);
kernel16 = variable(shape = [192, 480, 1, 1], label = 'InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/kernel');
bias16 = variable(shape = [1, 192], label = 'InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/bias');
conv16 = conv(pool5, kernel16, bias16, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu16 = relu(conv16);
kernel17 = variable(shape = [96, 480, 1, 1], label = 'InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/kernel');
bias17 = variable(shape = [1, 96], label = 'InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/bias');
conv17 = conv(pool5, kernel17, bias17, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu17 = relu(conv17);
kernel18 = variable(shape = [208, 96, 3, 3], label = 'InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/kernel');
bias18 = variable(shape = [1, 208], label = 'InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/bias');
conv18 = conv(relu17, kernel18, bias18, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu18 = relu(conv18);
kernel19 = variable(shape = [16, 480, 1, 1], label = 'InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/kernel');
bias19 = variable(shape = [1, 16], label = 'InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/bias');
conv19 = conv(pool5, kernel19, bias19, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu19 = relu(conv19);
kernel20 = variable(shape = [48, 16, 3, 3], label = 'InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_3x3/kernel');
bias20 = variable(shape = [1, 48], label = 'InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_3x3/bias');
conv20 = conv(relu19, kernel20, bias20, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu20 = relu(conv20);
pool6 = max_pool(pool5, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel21 = variable(shape = [64, 480, 1, 1], label = 'InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/kernel');
bias21 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/bias');
conv21 = conv(pool6, kernel21, bias21, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu21 = relu(conv21);
concat3 = concat([relu16,relu18,relu20,relu21], axis = 1);
kernel22 = variable(shape = [160, 512, 1, 1], label = 'InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/kernel');
bias22 = variable(shape = [1, 160], label = 'InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/bias');
conv22 = conv(concat3, kernel22, bias22, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu22 = relu(conv22);
kernel23 = variable(shape = [112, 512, 1, 1], label = 'InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/kernel');
bias23 = variable(shape = [1, 112], label = 'InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/bias');
conv23 = conv(concat3, kernel23, bias23, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu23 = relu(conv23);
kernel24 = variable(shape = [224, 112, 3, 3], label = 'InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/kernel');
bias24 = variable(shape = [1, 224], label = 'InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/bias');
conv24 = conv(relu23, kernel24, bias24, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu24 = relu(conv24);
kernel25 = variable(shape = [24, 512, 1, 1], label = 'InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/kernel');
bias25 = variable(shape = [1, 24], label = 'InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/bias');
conv25 = conv(concat3, kernel25, bias25, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu25 = relu(conv25);
kernel26 = variable(shape = [64, 24, 3, 3], label = 'InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_3x3/kernel');
bias26 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_3x3/bias');
conv26 = conv(relu25, kernel26, bias26, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu26 = relu(conv26);
pool7 = max_pool(concat3, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel27 = variable(shape = [64, 512, 1, 1], label = 'InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/kernel');
bias27 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/bias');
conv27 = conv(pool7, kernel27, bias27, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu27 = relu(conv27);
concat4 = concat([relu22,relu24,relu26,relu27], axis = 1);
kernel28 = variable(shape = [128, 512, 1, 1], label = 'InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/kernel');
bias28 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/bias');
conv28 = conv(concat4, kernel28, bias28, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu28 = relu(conv28);
kernel29 = variable(shape = [128, 512, 1, 1], label = 'InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/kernel');
bias29 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/bias');
conv29 = conv(concat4, kernel29, bias29, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu29 = relu(conv29);
kernel30 = variable(shape = [256, 128, 3, 3], label = 'InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/kernel');
bias30 = variable(shape = [1, 256], label = 'InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/bias');
conv30 = conv(relu29, kernel30, bias30, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu30 = relu(conv30);
kernel31 = variable(shape = [24, 512, 1, 1], label = 'InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/kernel');
bias31 = variable(shape = [1, 24], label = 'InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/bias');
conv31 = conv(concat4, kernel31, bias31, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu31 = relu(conv31);
kernel32 = variable(shape = [64, 24, 3, 3], label = 'InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_3x3/kernel');
bias32 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_3x3/bias');
conv32 = conv(relu31, kernel32, bias32, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu32 = relu(conv32);
pool8 = max_pool(concat4, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel33 = variable(shape = [64, 512, 1, 1], label = 'InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/kernel');
bias33 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/bias');
conv33 = conv(pool8, kernel33, bias33, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu33 = relu(conv33);
concat5 = concat([relu28,relu30,relu32,relu33], axis = 1);
kernel34 = variable(shape = [112, 512, 1, 1], label = 'InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/kernel');
bias34 = variable(shape = [1, 112], label = 'InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/bias');
conv34 = conv(concat5, kernel34, bias34, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu34 = relu(conv34);
kernel35 = variable(shape = [144, 512, 1, 1], label = 'InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/kernel');
bias35 = variable(shape = [1, 144], label = 'InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/bias');
conv35 = conv(concat5, kernel35, bias35, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu35 = relu(conv35);
kernel36 = variable(shape = [288, 144, 3, 3], label = 'InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/kernel');
bias36 = variable(shape = [1, 288], label = 'InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/bias');
conv36 = conv(relu35, kernel36, bias36, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu36 = relu(conv36);
kernel37 = variable(shape = [32, 512, 1, 1], label = 'InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/kernel');
bias37 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/bias');
conv37 = conv(concat5, kernel37, bias37, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu37 = relu(conv37);
kernel38 = variable(shape = [64, 32, 3, 3], label = 'InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_3x3/kernel');
bias38 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_3x3/bias');
conv38 = conv(relu37, kernel38, bias38, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu38 = relu(conv38);
pool9 = max_pool(concat5, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel39 = variable(shape = [64, 512, 1, 1], label = 'InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/kernel');
bias39 = variable(shape = [1, 64], label = 'InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/bias');
conv39 = conv(pool9, kernel39, bias39, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu39 = relu(conv39);
concat6 = concat([relu34,relu36,relu38,relu39], axis = 1);
kernel40 = variable(shape = [256, 528, 1, 1], label = 'InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/kernel');
bias40 = variable(shape = [1, 256], label = 'InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/bias');
conv40 = conv(concat6, kernel40, bias40, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu40 = relu(conv40);
kernel41 = variable(shape = [160, 528, 1, 1], label = 'InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/kernel');
bias41 = variable(shape = [1, 160], label = 'InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/bias');
conv41 = conv(concat6, kernel41, bias41, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu41 = relu(conv41);
kernel42 = variable(shape = [320, 160, 3, 3], label = 'InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/kernel');
bias42 = variable(shape = [1, 320], label = 'InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/bias');
conv42 = conv(relu41, kernel42, bias42, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu42 = relu(conv42);
kernel43 = variable(shape = [32, 528, 1, 1], label = 'InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/kernel');
bias43 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/bias');
conv43 = conv(concat6, kernel43, bias43, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu43 = relu(conv43);
kernel44 = variable(shape = [128, 32, 3, 3], label = 'InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_3x3/kernel');
bias44 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_3x3/bias');
conv44 = conv(relu43, kernel44, bias44, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu44 = relu(conv44);
pool10 = max_pool(concat6, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel45 = variable(shape = [128, 528, 1, 1], label = 'InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/kernel');
bias45 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/bias');
conv45 = conv(pool10, kernel45, bias45, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu45 = relu(conv45);
concat7 = concat([relu40,relu42,relu44,relu45], axis = 1);
pool11 = max_pool(concat7, size = [1, 1, 2, 2], padding = [], border = 'ignore', stride = [1, 1, 2, 2]);
kernel46 = variable(shape = [256, 832, 1, 1], label = 'InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/kernel');
bias46 = variable(shape = [1, 256], label = 'InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/bias');
conv46 = conv(pool11, kernel46, bias46, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu46 = relu(conv46);
kernel47 = variable(shape = [160, 832, 1, 1], label = 'InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/kernel');
bias47 = variable(shape = [1, 160], label = 'InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/bias');
conv47 = conv(pool11, kernel47, bias47, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu47 = relu(conv47);
kernel48 = variable(shape = [320, 160, 3, 3], label = 'InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/kernel');
bias48 = variable(shape = [1, 320], label = 'InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/bias');
conv48 = conv(relu47, kernel48, bias48, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu48 = relu(conv48);
kernel49 = variable(shape = [32, 832, 1, 1], label = 'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/kernel');
bias49 = variable(shape = [1, 32], label = 'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/bias');
conv49 = conv(pool11, kernel49, bias49, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu49 = relu(conv49);
kernel50 = variable(shape = [128, 32, 3, 3], label = 'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_3x3/kernel');
bias50 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_3x3/bias');
conv50 = conv(relu49, kernel50, bias50, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu50 = relu(conv50);
pool12 = max_pool(pool11, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel51 = variable(shape = [128, 832, 1, 1], label = 'InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/kernel');
bias51 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/bias');
conv51 = conv(pool12, kernel51, bias51, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu51 = relu(conv51);
concat8 = concat([relu46,relu48,relu50,relu51], axis = 1);
kernel52 = variable(shape = [384, 832, 1, 1], label = 'InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/kernel');
bias52 = variable(shape = [1, 384], label = 'InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/bias');
conv52 = conv(concat8, kernel52, bias52, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu52 = relu(conv52);
kernel53 = variable(shape = [192, 832, 1, 1], label = 'InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/kernel');
bias53 = variable(shape = [1, 192], label = 'InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/bias');
conv53 = conv(concat8, kernel53, bias53, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu53 = relu(conv53);
kernel54 = variable(shape = [384, 192, 3, 3], label = 'InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/kernel');
bias54 = variable(shape = [1, 384], label = 'InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/bias');
conv54 = conv(relu53, kernel54, bias54, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu54 = relu(conv54);
kernel55 = variable(shape = [48, 832, 1, 1], label = 'InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/kernel');
bias55 = variable(shape = [1, 48], label = 'InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/bias');
conv55 = conv(concat8, kernel55, bias55, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu55 = relu(conv55);
kernel56 = variable(shape = [128, 48, 3, 3], label = 'InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_3x3/kernel');
bias56 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_3x3/bias');
conv56 = conv(relu55, kernel56, bias56, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu56 = relu(conv56);
pool13 = max_pool(concat8, size = [1, 1, 3, 3], padding = [], border = 'ignore', stride = [1, 1, 1, 1]);
kernel57 = variable(shape = [128, 832, 1, 1], label = 'InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/kernel');
bias57 = variable(shape = [1, 128], label = 'InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/bias');
conv57 = conv(pool13, kernel57, bias57, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu57 = relu(conv57);
concat9 = concat([relu52,relu54,relu56,relu57], axis = 1);
pool14 = avg_pool(concat9, size = [1, 1, 7, 7], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 1, 1]);
kernel58 = variable(shape = [1000, 1024, 1, 1], label = 'InceptionV1/Logits/Conv2d_0c_1x1/kernel');
bias58 = variable(shape = [1, 1000], label = 'InceptionV1/Logits/Conv2d_0c_1x1/bias');
output = conv(pool14, kernel58, bias58, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
}
================================================
FILE: nnef-pyproject/examples/resnet.txt
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version 1.0;
graph resnet_v2_50( input ) -> ( output )
{
input = external(shape = [1, 3, 224, 224]);
kernel1 = variable(shape = [64, 3, 7, 7], label = 'resnet_v2_50/conv1/kernel');
bias1 = variable(shape = [1, 64], label = 'resnet_v2_50/conv1/bias');
conv1 = conv(input, kernel1, bias1, padding = [(3, 3), (3, 3)], border = 'constant', stride = [2, 2], dilation = [1, 1]);
pool1 = max_pool(conv1, size = [1, 1, 3, 3], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
beta1 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/preact/beta');
moving_mean1 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/preact/moving_mean');
moving_variance1 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/preact/moving_variance');
norm1 = batch_normalization(pool1, mean = moving_mean1, variance = moving_variance1, offset = beta1, scale = 1.0, epsilon = 0.001);
relu1 = relu(norm1);
kernel2 = variable(shape = [256, 64, 1, 1], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/shortcut/kernel');
bias2 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/shortcut/bias');
conv2 = conv(relu1, kernel2, bias2, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
kernel3 = variable(shape = [64, 64, 1, 1], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv1/kernel');
bias3 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv1/bias');
conv3 = conv(relu1, kernel3, bias3, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu2 = relu(conv3);
kernel4 = variable(shape = [64, 64, 3, 3], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv2/kernel');
bias4 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv2/bias');
conv4 = conv(relu2, kernel4, bias4, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu3 = relu(conv4);
kernel5 = variable(shape = [256, 64, 1, 1], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv3/kernel');
bias5 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_1/bottleneck_v2/conv3/bias');
conv5 = conv(relu3, kernel5, bias5, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add1 = add(conv2, conv5);
beta2 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/preact/beta');
moving_mean2 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/preact/moving_mean');
moving_variance2 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/preact/moving_variance');
norm2 = batch_normalization(add1, mean = moving_mean2, variance = moving_variance2, offset = beta2, scale = 1.0, epsilon = 0.001);
relu4 = relu(norm2);
kernel6 = variable(shape = [64, 256, 1, 1], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv1/kernel');
bias6 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv1/bias');
conv6 = conv(relu4, kernel6, bias6, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu5 = relu(conv6);
kernel7 = variable(shape = [64, 64, 3, 3], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv2/kernel');
bias7 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv2/bias');
conv7 = conv(relu5, kernel7, bias7, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu6 = relu(conv7);
kernel8 = variable(shape = [256, 64, 1, 1], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv3/kernel');
bias8 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_2/bottleneck_v2/conv3/bias');
conv8 = conv(relu6, kernel8, bias8, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add2 = add(add1, conv8);
beta3 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/preact/beta');
moving_mean3 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/preact/moving_mean');
moving_variance3 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/preact/moving_variance');
norm3 = batch_normalization(add2, mean = moving_mean3, variance = moving_variance3, offset = beta3, scale = 1.0, epsilon = 0.001);
relu7 = relu(norm3);
pool2 = max_pool(add2, size = [1, 1, 1, 1], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel9 = variable(shape = [64, 256, 1, 1], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv1/kernel');
bias9 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv1/bias');
conv9 = conv(relu7, kernel9, bias9, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu8 = relu(conv9);
kernel10 = variable(shape = [64, 64, 3, 3], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv2/kernel');
bias10 = variable(shape = [1, 64], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv2/bias');
conv10 = conv(relu8, kernel10, bias10, padding = [(1, 1), (1, 1)], border = 'constant', stride = [2, 2], dilation = [1, 1]);
relu9 = relu(conv10);
kernel11 = variable(shape = [256, 64, 1, 1], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv3/kernel');
bias11 = variable(shape = [1, 256], label = 'resnet_v2_50/block1/unit_3/bottleneck_v2/conv3/bias');
conv11 = conv(relu9, kernel11, bias11, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add3 = add(pool2, conv11);
beta4 = variable(shape = [1, 256], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/preact/beta');
moving_mean4 = variable(shape = [1, 256], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/preact/moving_mean');
moving_variance4 = variable(shape = [1, 256], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/preact/moving_variance');
norm4 = batch_normalization(add3, mean = moving_mean4, variance = moving_variance4, offset = beta4, scale = 1.0, epsilon = 0.001);
relu10 = relu(norm4);
kernel12 = variable(shape = [512, 256, 1, 1], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/shortcut/kernel');
bias12 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/shortcut/bias');
conv12 = conv(relu10, kernel12, bias12, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
kernel13 = variable(shape = [128, 256, 1, 1], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv1/kernel');
bias13 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv1/bias');
conv13 = conv(relu10, kernel13, bias13, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu11 = relu(conv13);
kernel14 = variable(shape = [128, 128, 3, 3], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv2/kernel');
bias14 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv2/bias');
conv14 = conv(relu11, kernel14, bias14, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu12 = relu(conv14);
kernel15 = variable(shape = [512, 128, 1, 1], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv3/kernel');
bias15 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_1/bottleneck_v2/conv3/bias');
conv15 = conv(relu12, kernel15, bias15, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add4 = add(conv12, conv15);
beta5 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/preact/beta');
moving_mean5 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/preact/moving_mean');
moving_variance5 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/preact/moving_variance');
norm5 = batch_normalization(add4, mean = moving_mean5, variance = moving_variance5, offset = beta5, scale = 1.0, epsilon = 0.001);
relu13 = relu(norm5);
kernel16 = variable(shape = [128, 512, 1, 1], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv1/kernel');
bias16 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv1/bias');
conv16 = conv(relu13, kernel16, bias16, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu14 = relu(conv16);
kernel17 = variable(shape = [128, 128, 3, 3], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv2/kernel');
bias17 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv2/bias');
conv17 = conv(relu14, kernel17, bias17, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu15 = relu(conv17);
kernel18 = variable(shape = [512, 128, 1, 1], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv3/kernel');
bias18 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_2/bottleneck_v2/conv3/bias');
conv18 = conv(relu15, kernel18, bias18, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add5 = add(add4, conv18);
beta6 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/preact/beta');
moving_mean6 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/preact/moving_mean');
moving_variance6 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/preact/moving_variance');
norm6 = batch_normalization(add5, mean = moving_mean6, variance = moving_variance6, offset = beta6, scale = 1.0, epsilon = 0.001);
relu16 = relu(norm6);
kernel19 = variable(shape = [128, 512, 1, 1], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv1/kernel');
bias19 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv1/bias');
conv19 = conv(relu16, kernel19, bias19, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu17 = relu(conv19);
kernel20 = variable(shape = [128, 128, 3, 3], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv2/kernel');
bias20 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv2/bias');
conv20 = conv(relu17, kernel20, bias20, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu18 = relu(conv20);
kernel21 = variable(shape = [512, 128, 1, 1], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv3/kernel');
bias21 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_3/bottleneck_v2/conv3/bias');
conv21 = conv(relu18, kernel21, bias21, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add6 = add(add5, conv21);
beta7 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/preact/beta');
moving_mean7 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/preact/moving_mean');
moving_variance7 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/preact/moving_variance');
norm7 = batch_normalization(add6, mean = moving_mean7, variance = moving_variance7, offset = beta7, scale = 1.0, epsilon = 0.001);
relu19 = relu(norm7);
pool3 = max_pool(add6, size = [1, 1, 1, 1], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel22 = variable(shape = [128, 512, 1, 1], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv1/kernel');
bias22 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv1/bias');
conv22 = conv(relu19, kernel22, bias22, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu20 = relu(conv22);
kernel23 = variable(shape = [128, 128, 3, 3], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv2/kernel');
bias23 = variable(shape = [1, 128], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv2/bias');
conv23 = conv(relu20, kernel23, bias23, padding = [(1, 1), (1, 1)], border = 'constant', stride = [2, 2], dilation = [1, 1]);
relu21 = relu(conv23);
kernel24 = variable(shape = [512, 128, 1, 1], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv3/kernel');
bias24 = variable(shape = [1, 512], label = 'resnet_v2_50/block2/unit_4/bottleneck_v2/conv3/bias');
conv24 = conv(relu21, kernel24, bias24, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add7 = add(pool3, conv24);
beta8 = variable(shape = [1, 512], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/preact/beta');
moving_mean8 = variable(shape = [1, 512], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/preact/moving_mean');
moving_variance8 = variable(shape = [1, 512], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/preact/moving_variance');
norm8 = batch_normalization(add7, mean = moving_mean8, variance = moving_variance8, offset = beta8, scale = 1.0, epsilon = 0.001);
relu22 = relu(norm8);
kernel25 = variable(shape = [1024, 512, 1, 1], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/shortcut/kernel');
bias25 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/shortcut/bias');
conv25 = conv(relu22, kernel25, bias25, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
kernel26 = variable(shape = [256, 512, 1, 1], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv1/kernel');
bias26 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv1/bias');
conv26 = conv(relu22, kernel26, bias26, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu23 = relu(conv26);
kernel27 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv2/kernel');
bias27 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv2/bias');
conv27 = conv(relu23, kernel27, bias27, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu24 = relu(conv27);
kernel28 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv3/kernel');
bias28 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_1/bottleneck_v2/conv3/bias');
conv28 = conv(relu24, kernel28, bias28, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add8 = add(conv25, conv28);
beta9 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/preact/beta');
moving_mean9 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/preact/moving_mean');
moving_variance9 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/preact/moving_variance');
norm9 = batch_normalization(add8, mean = moving_mean9, variance = moving_variance9, offset = beta9, scale = 1.0, epsilon = 0.001);
relu25 = relu(norm9);
kernel29 = variable(shape = [256, 1024, 1, 1], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv1/kernel');
bias29 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv1/bias');
conv29 = conv(relu25, kernel29, bias29, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu26 = relu(conv29);
kernel30 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv2/kernel');
bias30 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv2/bias');
conv30 = conv(relu26, kernel30, bias30, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu27 = relu(conv30);
kernel31 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv3/kernel');
bias31 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_2/bottleneck_v2/conv3/bias');
conv31 = conv(relu27, kernel31, bias31, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add9 = add(add8, conv31);
beta10 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/preact/beta');
moving_mean10 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/preact/moving_mean');
moving_variance10 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/preact/moving_variance');
norm10 = batch_normalization(add9, mean = moving_mean10, variance = moving_variance10, offset = beta10, scale = 1.0, epsilon = 0.001);
relu28 = relu(norm10);
kernel32 = variable(shape = [256, 1024, 1, 1], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv1/kernel');
bias32 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv1/bias');
conv32 = conv(relu28, kernel32, bias32, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu29 = relu(conv32);
kernel33 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv2/kernel');
bias33 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv2/bias');
conv33 = conv(relu29, kernel33, bias33, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu30 = relu(conv33);
kernel34 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv3/kernel');
bias34 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_3/bottleneck_v2/conv3/bias');
conv34 = conv(relu30, kernel34, bias34, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add10 = add(add9, conv34);
beta11 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/preact/beta');
moving_mean11 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/preact/moving_mean');
moving_variance11 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/preact/moving_variance');
norm11 = batch_normalization(add10, mean = moving_mean11, variance = moving_variance11, offset = beta11, scale = 1.0, epsilon = 0.001);
relu31 = relu(norm11);
kernel35 = variable(shape = [256, 1024, 1, 1], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv1/kernel');
bias35 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv1/bias');
conv35 = conv(relu31, kernel35, bias35, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu32 = relu(conv35);
kernel36 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv2/kernel');
bias36 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv2/bias');
conv36 = conv(relu32, kernel36, bias36, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu33 = relu(conv36);
kernel37 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv3/kernel');
bias37 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_4/bottleneck_v2/conv3/bias');
conv37 = conv(relu33, kernel37, bias37, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add11 = add(add10, conv37);
beta12 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/preact/beta');
moving_mean12 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/preact/moving_mean');
moving_variance12 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/preact/moving_variance');
norm12 = batch_normalization(add11, mean = moving_mean12, variance = moving_variance12, offset = beta12, scale = 1.0, epsilon = 0.001);
relu34 = relu(norm12);
kernel38 = variable(shape = [256, 1024, 1, 1], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv1/kernel');
bias38 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv1/bias');
conv38 = conv(relu34, kernel38, bias38, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu35 = relu(conv38);
kernel39 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv2/kernel');
bias39 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv2/bias');
conv39 = conv(relu35, kernel39, bias39, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu36 = relu(conv39);
kernel40 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv3/kernel');
bias40 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_5/bottleneck_v2/conv3/bias');
conv40 = conv(relu36, kernel40, bias40, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add12 = add(add11, conv40);
beta13 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/preact/beta');
moving_mean13 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/preact/moving_mean');
moving_variance13 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/preact/moving_variance');
norm13 = batch_normalization(add12, mean = moving_mean13, variance = moving_variance13, offset = beta13, scale = 1.0, epsilon = 0.001);
relu37 = relu(norm13);
pool4 = max_pool(add12, size = [1, 1, 1, 1], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel41 = variable(shape = [256, 1024, 1, 1], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv1/kernel');
bias41 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv1/bias');
conv41 = conv(relu37, kernel41, bias41, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu38 = relu(conv41);
kernel42 = variable(shape = [256, 256, 3, 3], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv2/kernel');
bias42 = variable(shape = [1, 256], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv2/bias');
conv42 = conv(relu38, kernel42, bias42, padding = [(1, 1), (1, 1)], border = 'constant', stride = [2, 2], dilation = [1, 1]);
relu39 = relu(conv42);
kernel43 = variable(shape = [1024, 256, 1, 1], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv3/kernel');
bias43 = variable(shape = [1, 1024], label = 'resnet_v2_50/block3/unit_6/bottleneck_v2/conv3/bias');
conv43 = conv(relu39, kernel43, bias43, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add13 = add(pool4, conv43);
beta14 = variable(shape = [1, 1024], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/preact/beta');
moving_mean14 = variable(shape = [1, 1024], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/preact/moving_mean');
moving_variance14 = variable(shape = [1, 1024], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/preact/moving_variance');
norm14 = batch_normalization(add13, mean = moving_mean14, variance = moving_variance14, offset = beta14, scale = 1.0, epsilon = 0.001);
relu40 = relu(norm14);
kernel44 = variable(shape = [2048, 1024, 1, 1], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/shortcut/kernel');
bias44 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/shortcut/bias');
conv44 = conv(relu40, kernel44, bias44, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
kernel45 = variable(shape = [512, 1024, 1, 1], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv1/kernel');
bias45 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv1/bias');
conv45 = conv(relu40, kernel45, bias45, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu41 = relu(conv45);
kernel46 = variable(shape = [512, 512, 3, 3], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv2/kernel');
bias46 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv2/bias');
conv46 = conv(relu41, kernel46, bias46, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu42 = relu(conv46);
kernel47 = variable(shape = [2048, 512, 1, 1], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv3/kernel');
bias47 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_1/bottleneck_v2/conv3/bias');
conv47 = conv(relu42, kernel47, bias47, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add14 = add(conv44, conv47);
beta15 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/preact/beta');
moving_mean15 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/preact/moving_mean');
moving_variance15 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/preact/moving_variance');
norm15 = batch_normalization(add14, mean = moving_mean15, variance = moving_variance15, offset = beta15, scale = 1.0, epsilon = 0.001);
relu43 = relu(norm15);
kernel48 = variable(shape = [512, 2048, 1, 1], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv1/kernel');
bias48 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv1/bias');
conv48 = conv(relu43, kernel48, bias48, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu44 = relu(conv48);
kernel49 = variable(shape = [512, 512, 3, 3], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv2/kernel');
bias49 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv2/bias');
conv49 = conv(relu44, kernel49, bias49, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu45 = relu(conv49);
kernel50 = variable(shape = [2048, 512, 1, 1], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv3/kernel');
bias50 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_2/bottleneck_v2/conv3/bias');
conv50 = conv(relu45, kernel50, bias50, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add15 = add(add14, conv50);
beta16 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/preact/beta');
moving_mean16 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/preact/moving_mean');
moving_variance16 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/preact/moving_variance');
norm16 = batch_normalization(add15, mean = moving_mean16, variance = moving_variance16, offset = beta16, scale = 1.0, epsilon = 0.001);
relu46 = relu(norm16);
kernel51 = variable(shape = [512, 2048, 1, 1], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv1/kernel');
bias51 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv1/bias');
conv51 = conv(relu46, kernel51, bias51, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu47 = relu(conv51);
kernel52 = variable(shape = [512, 512, 3, 3], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv2/kernel');
bias52 = variable(shape = [1, 512], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv2/bias');
conv52 = conv(relu47, kernel52, bias52, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu48 = relu(conv52);
kernel53 = variable(shape = [2048, 512, 1, 1], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv3/kernel');
bias53 = variable(shape = [1, 2048], label = 'resnet_v2_50/block4/unit_3/bottleneck_v2/conv3/bias');
conv53 = conv(relu48, kernel53, bias53, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
add16 = add(add15, conv53);
beta17 = variable(shape = [1, 2048], label = 'resnet_v2_50/postnorm/beta');
moving_mean17 = variable(shape = [1, 2048], label = 'resnet_v2_50/postnorm/moving_mean');
moving_variance17 = variable(shape = [1, 2048], label = 'resnet_v2_50/postnorm/moving_variance');
norm17 = batch_normalization(add16, mean = moving_mean17, variance = moving_variance17, offset = beta17, scale = 1.0, epsilon = 0.001);
relu49 = relu(norm17);
reduce1 = mean_reduce(relu49, axes = [2, 3]);
kernel54 = variable(shape = [1000, 2048, 1, 1], label = 'resnet_v2_50/logits/kernel');
bias54 = variable(shape = [1, 1000], label = 'resnet_v2_50/logits/bias');
output = conv(reduce1, kernel54, bias54, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
}
================================================
FILE: nnef-pyproject/examples/samples/sample.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import nnef
graph = nnef.parse_string(
"""
version 1.0;
graph Net( input ) -> ( output )
{
input = external(shape = [1,3,224,224]);
filter = variable(shape = [32,3,5,5], label = 'conv/filter');
output = conv(input, filter);
}
"""
)
print(nnef.format_graph(graph.name, graph.inputs, graph.outputs, graph.operations, graph.tensors))
================================================
FILE: nnef-pyproject/examples/samples/sample_ext.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import nnef
def shuffle_shape(input, groups):
assert input[1] % groups == 0, "input channels ({}) is not divisible by groups ({})".format(input[1], groups)
return input
graph = nnef.parse_string(
"""
version 1.0;
extension KHR_enable_fragment_definitions;
fragment shuffle<?>( input: tensor<?>, groups: integer ) -> ( output: tensor<?> );
graph Net( input ) -> ( output )
{
input = external(shape = [1,3,224,224]);
filter = variable(shape = [32,3,5,5], label = 'conv/filter');
conv = conv(input, filter);
output = shuffle(conv, groups = 4);
}
"""
)
nnef.infer_shapes(graph, custom_shapes={'shuffle': shuffle_shape})
print(nnef.format_graph(graph.name, graph.inputs, graph.outputs, graph.operations, graph.tensors))
================================================
FILE: nnef-pyproject/examples/samples/sample_gen.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import nnef
import numpy as np
from collections import OrderedDict
input = nnef.Tensor('input', dtype='scalar')
filter = nnef.Tensor('filter', dtype='scalar', data=np.random.randn(32,3,5,5))
output = nnef.Tensor('output', dtype='scalar')
external = nnef.Operation('external', attribs={'shape': [1,3,224,224]},
inputs=OrderedDict(),
outputs=OrderedDict([('output', nnef.Identifier('input'))]))
variable = nnef.Operation('variable', attribs={'shape': [32,3,5,5], 'label': 'conv/filter'},
inputs=OrderedDict(),
outputs=OrderedDict([('output', nnef.Identifier('filter'))]))
conv = nnef.Operation('conv', attribs={},
inputs=OrderedDict([('input', nnef.Identifier('input')), ('filter', nnef.Identifier('filter'))]),
outputs=OrderedDict([('output', nnef.Identifier('output'))]))
graph = nnef.Graph('G', inputs=['input'], outputs=['output'], operations=[external, variable, conv],
tensors={'input': input, 'filter': filter, 'output': output})
nnef.save_graph(graph, 'G', annotate_shapes=True)
================================================
FILE: nnef-pyproject/examples/vgg.txt
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version 1.0;
graph vgg_19( input ) -> ( output )
{
input = external(shape = [1, 3, 224, 224]);
kernel1 = variable(shape = [64, 3, 3, 3], label = 'vgg_19/conv1/conv1_1/kernel');
bias1 = variable(shape = [1, 64], label = 'vgg_19/conv1/conv1_1/bias');
conv1 = conv(input, kernel1, bias1, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu1 = relu(conv1);
kernel2 = variable(shape = [64, 64, 3, 3], label = 'vgg_19/conv1/conv1_2/kernel');
bias2 = variable(shape = [1, 64], label = 'vgg_19/conv1/conv1_2/bias');
conv2 = conv(relu1, kernel2, bias2, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu2 = relu(conv2);
pool1 = max_pool(relu2, size = [1, 1, 2, 2], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel3 = variable(shape = [128, 64, 3, 3], label = 'vgg_19/conv2/conv2_1/kernel');
bias3 = variable(shape = [1, 128], label = 'vgg_19/conv2/conv2_1/bias');
conv3 = conv(pool1, kernel3, bias3, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu3 = relu(conv3);
kernel4 = variable(shape = [128, 128, 3, 3], label = 'vgg_19/conv2/conv2_2/kernel');
bias4 = variable(shape = [1, 128], label = 'vgg_19/conv2/conv2_2/bias');
conv4 = conv(relu3, kernel4, bias4, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu4 = relu(conv4);
pool2 = max_pool(relu4, size = [1, 1, 2, 2], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel5 = variable(shape = [256, 128, 3, 3], label = 'vgg_19/conv3/conv3_1/kernel');
bias5 = variable(shape = [1, 256], label = 'vgg_19/conv3/conv3_1/bias');
conv5 = conv(pool2, kernel5, bias5, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu5 = relu(conv5);
kernel6 = variable(shape = [256, 256, 3, 3], label = 'vgg_19/conv3/conv3_2/kernel');
bias6 = variable(shape = [1, 256], label = 'vgg_19/conv3/conv3_2/bias');
conv6 = conv(relu5, kernel6, bias6, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu6 = relu(conv6);
kernel7 = variable(shape = [256, 256, 3, 3], label = 'vgg_19/conv3/conv3_3/kernel');
bias7 = variable(shape = [1, 256], label = 'vgg_19/conv3/conv3_3/bias');
conv7 = conv(relu6, kernel7, bias7, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu7 = relu(conv7);
kernel8 = variable(shape = [256, 256, 3, 3], label = 'vgg_19/conv3/conv3_4/kernel');
bias8 = variable(shape = [1, 256], label = 'vgg_19/conv3/conv3_4/bias');
conv8 = conv(relu7, kernel8, bias8, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu8 = relu(conv8);
pool3 = max_pool(relu8, size = [1, 1, 2, 2], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel9 = variable(shape = [512, 256, 3, 3], label = 'vgg_19/conv4/conv4_1/kernel');
bias9 = variable(shape = [1, 512], label = 'vgg_19/conv4/conv4_1/bias');
conv9 = conv(pool3, kernel9, bias9, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu9 = relu(conv9);
kernel10 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv4/conv4_2/kernel');
bias10 = variable(shape = [1, 512], label = 'vgg_19/conv4/conv4_2/bias');
conv10 = conv(relu9, kernel10, bias10, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu10 = relu(conv10);
kernel11 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv4/conv4_3/kernel');
bias11 = variable(shape = [1, 512], label = 'vgg_19/conv4/conv4_3/bias');
conv11 = conv(relu10, kernel11, bias11, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu11 = relu(conv11);
kernel12 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv4/conv4_4/kernel');
bias12 = variable(shape = [1, 512], label = 'vgg_19/conv4/conv4_4/bias');
conv12 = conv(relu11, kernel12, bias12, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu12 = relu(conv12);
pool4 = max_pool(relu12, size = [1, 1, 2, 2], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel13 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv5/conv5_1/kernel');
bias13 = variable(shape = [1, 512], label = 'vgg_19/conv5/conv5_1/bias');
conv13 = conv(pool4, kernel13, bias13, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu13 = relu(conv13);
kernel14 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv5/conv5_2/kernel');
bias14 = variable(shape = [1, 512], label = 'vgg_19/conv5/conv5_2/bias');
conv14 = conv(relu13, kernel14, bias14, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu14 = relu(conv14);
kernel15 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv5/conv5_3/kernel');
bias15 = variable(shape = [1, 512], label = 'vgg_19/conv5/conv5_3/bias');
conv15 = conv(relu14, kernel15, bias15, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu15 = relu(conv15);
kernel16 = variable(shape = [512, 512, 3, 3], label = 'vgg_19/conv5/conv5_4/kernel');
bias16 = variable(shape = [1, 512], label = 'vgg_19/conv5/conv5_4/bias');
conv16 = conv(relu15, kernel16, bias16, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu16 = relu(conv16);
pool5 = max_pool(relu16, size = [1, 1, 2, 2], padding = [(0, 0), (0, 0), (0, 0), (0, 0)], border = 'ignore', stride = [1, 1, 2, 2]);
kernel17 = variable(shape = [4096, 512, 7, 7], label = 'vgg_19/fc6/kernel');
bias17 = variable(shape = [1, 4096], label = 'vgg_19/fc6/bias');
conv17 = conv(pool5, kernel17, bias17, padding = [(0, 0), (0, 0)], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu17 = relu(conv17);
kernel18 = variable(shape = [4096, 4096, 1, 1], label = 'vgg_19/fc7/kernel');
bias18 = variable(shape = [1, 4096], label = 'vgg_19/fc7/bias');
conv18 = conv(relu17, kernel18, bias18, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
relu18 = relu(conv18);
kernel19 = variable(shape = [1000, 4096, 1, 1], label = 'vgg_19/fc8/kernel');
bias19 = variable(shape = [1, 1000], label = 'vgg_19/fc8/bias');
output = conv(relu18, kernel19, bias19, padding = [], border = 'constant', stride = [1, 1], dilation = [1, 1]);
}
================================================
FILE: nnef-pyproject/nnef/__init__.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import _nnef
from .parser import *
from .printer import *
from .binary import read_tensor, write_tensor
from .shapes import infer_shapes, _StandardShapeFuncs
import os
Identifier = _nnef.Identifier # subclass of str
Error = _nnef.Error # subclass of exception
Graph = _nnef.Graph # namedtuple('Graph', ['name': str, 'tensors': typing.Dict[str, Tensor], 'operations': typing.List[Operation],
# 'inputs': typing.List[str], 'outputs': typing.List['str']])
Tensor = _nnef.Tensor # namedtuple('Tensor', ['name': str, 'dtype': str, 'shape': typing.List[int], 'data': numpy.ndarray,
# 'quantization': Dict[str, object]])
Operation = _nnef.Operation # namedtuple('Operation', ['name': str, 'attribs': OrderedDict[str, object], 'inputs': OrderedDict[str, object],
# 'outputs': OrderedDict[str, object], 'dtype': str])
Tensor.__new__.__defaults__ = (None, None, None)
Operation.__new__.__defaults__ = (None,)
StandardOperations = set(_StandardShapeFuncs.keys())
def load_graph(path, stdlib=None, lowered=None, load_variables=True):
if os.path.isfile(path):
return parse_file(path, stdlib=stdlib, lowered=lowered)
graph_fn = os.path.join(path, 'graph.nnef')
quant_fn = os.path.join(path, 'graph.quant')
graph = parse_file(graph_fn, quant_fn if os.path.isfile(quant_fn) else None, stdlib=stdlib, lowered=lowered)
if load_variables:
for operation in graph.operations:
if operation.name == 'variable':
variable_filename = operation.attribs['label'] + '.dat'
if variable_filename.startswith('/'):
variable_filename = variable_filename[1:]
variable_filename = os.path.join(path, variable_filename)
tensor_name = operation.outputs['output']
with open(variable_filename) as variable_file:
data = read_tensor(variable_file)
data_shape = list(data.shape)
shape = operation.attribs['shape']
if data_shape != shape:
raise _nnef.Error('shape {} in variable file does not match shape {} defined in network structure'
.format(data_shape, shape))
tensor = graph.tensors[tensor_name]
graph.tensors[tensor_name] = _nnef.Tensor(tensor.name, tensor.dtype, data_shape, data, tensor.quantization)
return graph
def save_graph(graph, path, annotate_shapes=False):
if os.path.exists(path):
raise RuntimeError("folder already exists: '{}'".format(path))
os.makedirs(path)
text = format_graph(graph.name, graph.inputs, graph.outputs, graph.operations, graph.tensors, annotate_shapes=annotate_shapes)
with open(os.path.join(path, 'graph.nnef'), mode='w') as file:
file.write('version 1.0;\n\n')
file.write(text)
for operation in graph.operations:
if operation.name == 'variable':
variable_filename = operation.attribs['label'] + '.dat'
if variable_filename.startswith('/'):
variable_filename = variable_filename[1:]
variable_filename = os.path.join(path, variable_filename)
os.makedirs(os.path.split(variable_filename)[0], exist_ok=True)
tensor_name = operation.outputs['output']
tensor = graph.tensors[tensor_name]
if tensor.data is not None:
with open(variable_filename, 'wb') as variable_file:
write_tensor(variable_file, tensor.data, quantized=bool(tensor.quantization))
class Session:
def __init__(self, path, stdlib=None, lowered=None):
self._handle = _nnef.create_session(path, stdlib=stdlib, lowered=lowered)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
_nnef.cleanup_session(self._handle)
def __call__(self, *inputs):
return _nnef.execute_session(self._handle, tuple(inputs))
================================================
FILE: nnef-pyproject/nnef/binary.py
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import numpy as np
class ItemType:
FLOAT = 0
UINT = 1
QUINT = 2
QINT = 3
INT = 4
BOOL = 5
def _numpy_dtype_split(dtype):
splits = {
np.float16: (ItemType.FLOAT, 16),
np.float32: (ItemType.FLOAT, 32),
np.float64: (ItemType.FLOAT, 64),
np.int8: (ItemType.INT, 8),
np.uint8: (ItemType.UINT, 8),
np.int16: (ItemType.INT, 16),
np.uint16: (ItemType.UINT, 16),
np.int32: (ItemType.INT, 32),
np.uint32: (ItemType.UINT, 32),
np.int64: (ItemType.INT, 64),
np.uint64: (ItemType.UINT, 64),
np.bool_: (ItemType.BOOL, 1),
}
split = splits.get(dtype.type)
if split is None:
raise TypeError('unsupported tensor dtype: ' + str(dtype))
return split
def _numpy_dtype_make(item_type, bits):
dtypes = {
(ItemType.FLOAT, 16): np.float16,
(ItemType.FLOAT, 32): np.float32,
(ItemType.FLOAT, 64): np.float64,
(ItemType.INT, 8): np.int8,
(ItemType.INT, 16): np.int16,
(ItemType.INT, 32): np.int32,
(ItemType.INT, 64): np.int64,
(ItemType.UINT, 8): np.uint8,
(ItemType.UINT, 16): np.uint16,
(ItemType.UINT, 32): np.uint32,
(ItemType.UINT, 64): np.uint64,
(ItemType.QINT, 8): np.int8,
(ItemType.QINT, 16): np.int16,
(ItemType.QINT, 32): np.int32,
(ItemType.QINT, 64): np.int64,
(ItemType.QUINT, 8): np.uint8,
(ItemType.QUINT, 16): np.uint16,
(ItemType.QUINT, 32): np.uint32,
(ItemType.QUINT, 64): np.uint64,
(ItemType.BOOL, 1): np.bool_,
}
dtype = dtypes.get((item_type, bits))
if dtype is None:
raise ValueError('unsupported combination of item type ({}) and bits per item ({})'.format(item_type, bits))
return dtype
MaxTensorRank = 8
def _rank_of(shape):
rank = len(shape)
while rank > 1 and shape[rank - 1] == 1:
rank -= 1
return rank
_is_little_endian = sys.byteorder == 'little'
def _tofile(data, file):
if not _is_little_endian and data.dtype != np.uint8 and data.dtype != np.int8:
data = data.byteswap()
if file.seekable():
data.tofile(file)
else:
file.write(data.tobytes())
def _fromfile(file, dtype, count):
if file.seekable():
data = np.fromfile(file, dtype, count)
else:
data = np.frombuffer(file.read(count * np.dtype(dtype).itemsize), dtype, count)
if not _is_little_endian and data.dtype != np.uint8 and data.dtype != np.int8:
data = data.byteswap()
return data
def write_tensor(file, tensor, quantized=False, version=(1, 0)):
if isinstance(file, str):
raise ValueError('file parameter must be a file object not a file name')
_tofile(np.asarray([0x4E, 0xEF, version[0], version[1]], dtype=np.uint8), file)
item_type, bits = _numpy_dtype_split(tensor.dtype)
if quantized:
if item_type == ItemType.INT:
item_type = ItemType.QINT
elif item_type == ItemType.UINT:
item_type = ItemType.QUINT
else:
raise ValueError("invalid tensor dtype '{}' for quantized tensor".format(tensor.dtype))
count = int(np.prod(tensor.shape))
data_length = (count + 7) // 8 if bits == 1 else count * (bits // 8)
_tofile(np.asarray([data_length, tensor.ndim], dtype=np.uint32), file)
if tensor.ndim > MaxTensorRank:
raise ValueError('tensor rank exceeds maximum possible value of {}'.format(MaxTensorRank))
_tofile(np.asarray(tensor.shape, dtype=np.uint32), file)
_tofile(np.asarray([0] * (MaxTensorRank - tensor.ndim), dtype=np.uint32), file)
_tofile(np.asarray([bits, item_type], dtype=np.uint32), file)
_tofile(np.asarray([0] * 19, dtype=np.uint32), file)
data = np.packbits(tensor) if bits == 1 else tensor
_tofile(data, file)
def read_tensor(file, return_quantization=False):
if isinstance(file, str):
raise ValueError('file parameter must be a file object not a file name')
[magic1, magic2, major, minor] = _fromfile(file, dtype=np.uint8, count=4)
if magic1 != 0x4E or magic2 != 0xEF:
raise ValueError('not a valid NNEF file')
if major > 1 or minor > 0:
raise ValueError('unsupported file version')
[data_length, rank] = _fromfile(file, dtype=np.uint32, count=2)
if file.seekable():
header_size = 128
file_size = os.fstat(file.fileno()).st_size
if file_size != header_size + data_length:
raise ValueError('invalid tensor file; size does not match header info')
if rank > MaxTensorRank:
raise ValueError('tensor rank exceeds maximum possible value of {}'.format(MaxTensorRank))
shape = _fromfile(file, dtype=np.uint32, count=MaxTensorRank)
shape = shape[:rank]
[bits, item_type] = _fromfile(file, dtype=np.uint32, count=2)
_reserved = _fromfile(file, dtype=np.uint32, count=19)
if item_type == ItemType.UINT and _reserved[0] != 0:
item_type = ItemType.INT
quantized = item_type == ItemType.QINT or item_type == ItemType.QUINT
count = int(np.prod(shape))
if bits == 1:
byte_count = int((count + 7) // 8)
data = _fromfile(file, dtype=np.uint8, count=byte_count)
if len(data) != byte_count:
raise ValueError('could not read tensor data')
data = np.unpackbits(data).astype(bool)[:count]
else:
data = _fromfile(file, dtype=_numpy_dtype_make(item_type, bits), count=count)
if len(data) != count:
raise ValueError('could not read tensor data')
tensor = data.reshape(shape)
return (tensor, quantized) if return_quantization else tensor
def _write_tensor_provisional(file, tensor, version=(1, 0)):
_tofile(np.asarray([0x4E, 0xEF, version[0], version[1]], dtype=np.uint8), file)
header_length = 4 + 4 + (tensor.ndim + 1) * 4 + 4
_tofile(np.asarray([header_length], dtype=np.uint32), file)
_tofile(np.asarray([tensor.ndim], dtype=np.uint32), file)
_tofile(np.asarray(tensor.shape, dtype=np.uint32), file)
dtype, bits = _numpy_dtype_split(tensor.dtype)
_tofile(np.asarray([dtype, bits], dtype=np.uint8), file)
_tofile(np.asarray([0], dtype=np.uint16), file)
_tofile(tensor, file)
def _read_tensor_provisional(file):
[magic1, magic2, major, minor] = _fromfile(file, dtype=np.uint8, count=4)
if magic1 != 0x4E or magic2 != 0xEF:
raise ValueError('not a valid NNEF file')
if major > 1 or minor > 0:
raise ValueError('unsupported file version')
[_header_length] = _fromfile(file, dtype=np.uint32, count=1)
[rank] = _fromfile(file, dtype=np.uint32, count=1)
shape = _fromfile(file, dtype=np.uint32, count=rank)
[code, bits] = _fromfile(file, dtype=np.uint8, count=2)
[qlen] = _fromfile(file, dtype=np.uint16, count=1)
assert (code == 0)
assert (bits == 32)
assert (qlen == 0)
return _fromfile(file, dtype=np.float32, count=int(np.prod(shape))).reshape(shape)
================================================
FILE: nnef-pyproject/nnef/cpp/CMakeLists.txt
================================================
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.0)
project(nnef CXX)
# build information
message(STATUS "Build Configuration: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build executables in: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# nnef library
add_library(${PROJECT_NAME}
include/cnnef.h
include/nnef.h
include/nnef/common/binary.h
include/nnef/common/dictionary.h
include/nnef/common/error.h
include/nnef/common/lexer.h
include/nnef/common/parser.h
include/nnef/common/prototype.h
include/nnef/common/shapes.h
include/nnef/common/typespec.h
include/nnef/common/typeutils.h
include/nnef/common/value.h
include/nnef/comp/comp_parser.h
include/nnef/comp/evaluation.h
include/nnef/comp/expression.h
include/nnef/comp/fragment.h
include/nnef/comp/stdlib_source.h
include/nnef/flat/flat_parser.h
include/nnef/flat/quant_parser.h
include/nnef/flat/stdlib_protos.h
src/nnef.cpp
src/cnnef.cpp
)
# build interface include dir is used when this cmake is included into
# a larger project
# install interface include dir will be put into the generated cmake config file
# during install step
target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:include>)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX _d)
target_link_libraries(${PROJECT_NAME})
# install the library
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
# then the headers
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION .)
# generate and install cmake config file for find_package
install(EXPORT ${PROJECT_NAME} DESTINATION lib/cmake/${PROJECT_NAME})
# generate an auxiliary config file also needed by find_package
# it just includes the previously generated nnef.cmake
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake "include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}.cmake)")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION lib/cmake/${PROJECT_NAME})
================================================
FILE: nnef-pyproject/nnef/cpp/include/cnnef.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _CNNEF_H_
#define _CNNEF_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
#if _WIN32
#define EXPORTDLL extern "C" __declspec(dllexport)
#else
#define EXPORTDLL extern "C"
#endif
#else // __cplusplus
#if _WIN32
#define EXPORTDLL __declspec(dllexport)
#else
#define EXPORTDLL
#endif
#endif // __cplusplus
typedef void* nnef_graph_t;
typedef void* nnef_tensor_t;
/*
* Load NNEF graph from file
*
* @param path: the path to the NNEF model folder
* @param error: the string to store the error message if any
*
* @return NNEF graph
*/
EXPORTDLL nnef_graph_t nnef_graph_load( const char* path, char *error );
/*
* Copy an NNEF graph
*
* @param graph: NNEF graph
*
* @return the copy of NNEF graph
*/
EXPORTDLL nnef_graph_t nnef_graph_copy( nnef_graph_t graph );
/*
* Release NNEF graph
*
* @param graph: NNEF graph
*/
EXPORTDLL void nnef_graph_release( nnef_graph_t graph );
/*
* Perform shape inference on the graph
*
* @param graph: the graph object
* @param error: the string to store the error message if any
*
* @return true if there were no errors, false otherwise
*/
EXPORTDLL int nnef_graph_infer_shapes( nnef_graph_t graph, char *error );
/*
* Allocate tensor buffers in the graph
*
* @param graph: the graph object
* @param error: the string to store the error message if any
*
* @return true if there were no errors, false otherwise
*/
EXPORTDLL int nnef_graph_allocate_buffers( nnef_graph_t graph, char *error );
/*
* Execute a graph
*
* @param graph: the graph object
* @param error: the string to store the error message if any
*
* @return true if there were no errors, false otherwise
*/
EXPORTDLL int nnef_graph_execute( nnef_graph_t graph, char *error );
/*
* Query input names from NNEF graph
*
* @param graph: NNEF graph
* @param inputs: input names
*
* @return input count
*/
EXPORTDLL size_t nnef_graph_input_names( nnef_graph_t graph, const char** inputs );
/*
* Query output names from NNEF graph
*
* @param graph: NNEF graph
* @param inputs: output names
*
* @return output count
*/
EXPORTDLL size_t nnef_graph_output_names( nnef_graph_t graph, const char** outputs );
/*
* Find tensor in NNEF graph by name
*
* @param graph: NNEF graph
* @param tensor_name: tensor name
*
* @return tensor
*/
EXPORTDLL nnef_tensor_t nnef_graph_find_tensor( nnef_graph_t graph, const char* tensor_name );
/*
* Query name of an NNEF graph
*
* @param graph: NNEF graph
*
* @return graph name
*/
EXPORTDLL const char* nnef_graph_name( nnef_graph_t graph );
/*
* Create a new tensor
*
* @return tensor
*/
EXPORTDLL nnef_tensor_t nnef_tensor_create(void);
/*
* Release a tensor
*/
EXPORTDLL void nnef_tensor_release( nnef_tensor_t tensor );
/*
* Query tensor name
*
* @param tensor: tensor
*
* @return tensor name
*/
EXPORTDLL const char* nnef_tensor_name( nnef_tensor_t tensor );
/*
* Query tensor data-type
*
* @param tensor: tensor
*
* @return data-type name
*/
EXPORTDLL const char* nnef_tensor_dtype( nnef_tensor_t tensor );
/*
* Query tensor rank
*
* @param tensor: tensor
*
* @return tensor rank
*/
EXPORTDLL size_t nnef_tensor_rank( nnef_tensor_t tensor );
/*
* Query tensor dims
*
* @param tensor: tensor
*
* @return tensor rank
*/
EXPORTDLL const int* nnef_tensor_dims( nnef_tensor_t tensor );
/*
* Query tensor data
*
* @param tensor: tensor
*
* @return tensor data
*/
EXPORTDLL void* nnef_tensor_data( nnef_tensor_t tensor );
/*
* Read tensor from binary file
*
* @param url: the name of the file to read from
* @param tensor: tensor
* @param error: the string to store the error message if any
*
* @return true if there were no errors, false otherwise
*/
EXPORTDLL int nnef_tensor_read( const char* path, nnef_tensor_t tensor, char *error );
/*
* Write tensor to binary file
*
* @param url: the name of the file to write to
* @param tensor: tensor
* @param error: the string to store the error message if any
*
* @return true if there were no errors, false otherwise
*/
EXPORTDLL int nnef_tensor_write( const char* path, nnef_tensor_t tensor, char *error );
#ifdef __cplusplus
}
#endif
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/binary.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_BINARY_H_
#define _NNEF_BINARY_H_
#include "error.h"
#include <cstdint>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
namespace nnef
{
struct TensorHeader
{
enum { MaxRank = 8 };
enum ItemType { Float, Uint, Quint, Qint, Int, Bool };
uint8_t magic[2];
uint8_t version[2];
uint32_t data_length;
uint32_t rank;
uint32_t extents[MaxRank];
uint32_t bits_per_item;
uint32_t item_type;
uint32_t reserved[19];
};
template<typename In, typename Out>
void copy_and_cast_n( In* input, size_t n, Out* output )
{
for ( size_t i = 0; i < n; ++i )
{
*output++ = (Out)*input++;
}
}
template<typename T>
inline void fill_tensor_header( TensorHeader& header, const size_t version[2], const size_t rank, const T* extents,
const size_t bits_per_item, const TensorHeader::ItemType item_type )
{
const char* magic = "N\xEF";
std::fill_n((uint8_t*)&header, sizeof(header), (uint8_t)0);
header.magic[0] = (uint8_t)magic[0];
header.magic[1] = (uint8_t)magic[1];
header.version[0] = (uint8_t)version[0];
header.version[1] = (uint8_t)version[1];
if ( rank > TensorHeader::MaxRank )
{
throw Error("tensor rank %d exceeds maximum possible value (%d)", (int)rank, (int)TensorHeader::MaxRank);
}
const uint32_t item_count = std::accumulate(extents, extents + rank, (uint32_t)1, std::multiplies<uint32_t>());
header.data_length = (uint32_t)((item_count * bits_per_item + 7) / 8);
header.bits_per_item = (uint32_t)bits_per_item;
header.rank = (uint32_t)rank;
header.item_type = item_type;
std::copy_n(extents, rank, header.extents);
}
inline void validate_tensor_header( const TensorHeader& header )
{
if ( header.magic[0] != 'N' || header.magic[1] != 0xEF )
{
throw Error("invliad magic number in tensor binary");
}
if ( header.version[0] != 1 || header.version[1] != 0 )
{
throw Error("unknown version number %d.%d", (int)header.version[0], (int)header.version[1]);
}
if ( header.rank > TensorHeader::MaxRank )
{
throw Error("tensor rank %d exceeds maximum allowed rank (%d)", (int)header.rank, (int)TensorHeader::MaxRank);
}
const size_t item_count = std::accumulate(header.extents, header.extents + header.rank, (size_t)1, std::multiplies<size_t>());
if ( (size_t)header.data_length != (item_count * header.bits_per_item + 7) / 8 )
{
throw Error("data length is not compatible with extents and bits per item");
}
if ( (header.item_type & 0xffff0000) == 0 ) // Khronos-defined item type
{
const uint32_t code = (header.item_type & 0x0000ffff);
switch ( code )
{
case TensorHeader::Float:
{
if ( header.bits_per_item != 16 && header.bits_per_item != 32 && header.bits_per_item != 64 )
{
throw Error("invalid bits per item for float item type: %d", (int)header.bits_per_item);
}
break;
}
case TensorHeader::Int:
case TensorHeader::Uint:
case TensorHeader::Quint:
case TensorHeader::Qint:
{
if ( header.bits_per_item > 64 )
{
throw Error("invalid bits per item for integer item type: %d", (int)header.bits_per_item);
}
break;
}
case TensorHeader::Bool:
{
if ( header.bits_per_item != 1 && header.bits_per_item != 8 )
{
throw Error("invalid bits per item for bool item type: %d", (int)header.bits_per_item);
}
break;
}
default:
{
throw Error("unkown Khronos-defined item type code: %x", (int)code);
}
}
}
}
inline void pack_bits( const size_t n, const bool* data, char* bytes )
{
for ( size_t i = 0; i < n; ++i )
{
bytes[i / 8] |= (data[i] << (7 - (i % 8)));
}
}
inline void unpack_bits( const size_t n, const char* bytes, bool* data )
{
for ( size_t i = 0; i < n; ++i )
{
data[i] = (bytes[i / 8] >> (7 - (i % 8))) & 0x01;
}
}
inline void from_bytes( const char* bytes, const size_t count, const size_t bits_per_item, float* data )
{
if ( bits_per_item == 32 )
{
copy_and_cast_n((const float*)bytes, count, data);
}
else if ( bits_per_item == 64 )
{
copy_and_cast_n((const double*)bytes, count, data);
}
else
{
throw std::runtime_error("cannot load float data of " + std::to_string(bits_per_item) + " bits per item");
}
}
inline void from_bytes( const char* bytes, const size_t count, const size_t bits_per_item, int* data, const bool is_signed )
{
if ( bits_per_item == 8 )
{
if ( is_signed )
{
copy_and_cast_n((const int8_t*)bytes, count, data);
}
else
{
copy_and_cast_n((const uint8_t*)bytes, count, data);
}
}
else if ( bits_per_item == 16 )
{
if ( is_signed )
{
copy_and_cast_n((const int16_t*)bytes, count, data);
}
else
{
copy_and_cast_n((const uint16_t*)bytes, count, data);
}
}
else if ( bits_per_item == 32 )
{
if ( is_signed )
{
copy_and_cast_n((const int32_t*)bytes, count, data);
}
else
{
copy_and_cast_n((const uint32_t*)bytes, count, data);
}
}
else if ( bits_per_item == 64 )
{
if ( is_signed )
{
copy_and_cast_n((const int64_t*)bytes, count, data);
}
else
{
copy_and_cast_n((const uint64_t*)bytes, count, data);
}
}
else
{
throw std::runtime_error("cannot load int data of " + std::to_string(bits_per_item) + " bits per item");
}
}
inline void from_bytes( const char* bytes, const size_t count, const size_t bits_per_item, bool* data )
{
if ( bits_per_item == 1 )
{
unpack_bits(count, bytes, data);
}
else if ( bits_per_item == 8 )
{
copy_and_cast_n((const int8_t*)bytes, count, data);
}
else
{
throw std::runtime_error("cannot load bool data of " + std::to_string(bits_per_item) + " bits per item");
}
}
inline void to_bytes( const float* data, const size_t count, char* bytes )
{
copy_and_cast_n(data, count, (float*)bytes);
}
inline void to_bytes( const int* data, const size_t count, char* bytes, const bool as_signed )
{
if ( as_signed )
{
copy_and_cast_n(data, count, (int32_t*)bytes);
}
else
{
copy_and_cast_n(data, count, (uint32_t*)bytes);
}
}
inline void to_bytes( const bool* data, const size_t count, char* bytes )
{
pack_bits(count, data, bytes);
}
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/dictionary.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_DICTIONARY_H_
#define _NNEF_DICTIONARY_H_
#include <string>
#include <map>
namespace nnef
{
template<typename T>
using Dictionary = std::map<std::string,T>;
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/error.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_ERROR_H_
#define _NNEF_ERROR_H_
#include <exception>
#include <cstdarg>
#include <string>
namespace nnef
{
class Error : public std::exception
{
public:
struct Position
{
unsigned line;
unsigned column;
const char* filename;
const Position* origin;
};
public:
template<class... Args>
Error( const Position& position, const char* format, Args&&... args )
: _position(position), _message(formatString(format, std::forward<Args>(args)...))
{
}
template<class... Args>
Error( const char* format, Args&&... args )
: _position({0,0,nullptr,nullptr}), _message(formatString(format, std::forward<Args>(args)...))
{
}
virtual const char* what() const noexcept
{
return _message.c_str();
}
const Position& position() const
{
return _position;
}
public:
static std::string formatString( const char* fmt, ... )
{
va_list args;
va_start(args, fmt);
auto length = vsnprintf(nullptr, 0, fmt, args);
va_end(args);
if ( length < 0 )
{
throw std::logic_error("string formatting error");
}
std::string str(length, '\0');
va_start(args, fmt);
vsnprintf((char*)str.data(), length + 1, fmt, args);
va_end(args);
return str;
}
private:
Position _position;
std::string _message;
};
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/lexer.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_LEXER_H_
#define _NNEF_LEXER_H_
#include "error.h"
#include <iostream>
#include <cctype>
#include <string>
#include <map>
namespace nnef
{
class Lexer
{
public:
typedef Error::Position Position;
public:
enum Token
{
Eof,
Version,
Extension,
Identifier,
Characters,
Decimal,
Fractional,
Graph,
Fragment,
Tensor,
Integer,
Scalar,
Logical,
String,
True,
False,
For,
In,
If,
Else,
Yield,
LengthOf,
ShapeOf,
RangeOf,
Arrow,
And,
Or,
Le,
Ge,
Eq,
Ne,
};
static std::string tokenString( int token )
{
static const std::string strings[] =
{
"eof",
"version",
"extension",
"identifier",
"literal",
"decimal",
"fractional",
"graph",
"fragment",
"tensor",
"integer",
"scalar",
"logical",
"string",
"true",
"false",
"for",
"in",
"if",
"else",
"yield",
"length_of",
"shape_of",
"range_of",
"->",
"&&",
"||",
"<=",
">=",
"==",
"!=",
};
char ch = (char)token;
return token <= Ne ? strings[token] : std::string(&ch, 1);
}
static bool isType( int token )
{
return token >= Tensor && token <= String;
}
static bool isKeyword( int token )
{
return token >= Fragment && token <= False;
}
static bool isOperator( int token )
{
return token >= LengthOf;
}
public:
Lexer( std::istream& input, const char* filename )
: _input(input), _position({1,1,filename,nullptr}), _token(Eof)
{
}
void next()
{
_position.column += (unsigned)_string.length() + 2 * (_token == Characters);
skipSpace();
skipComment();
_string.clear();
if ( _input.peek() == EOF )
{
_token = Eof;
}
else if ( _input.peek() == '\'' || _input.peek() == '\"' )
{
_token = getCharacters();
}
else if ( std::isalpha(_input.peek()) || _input.peek() == '_' )
{
_token = getIdentifier();
}
else if ( std::isdigit(_input.peek()) )
{
_token = getNumber();
}
else
{
_token = getOperator();
}
}
int token() const
{
return _token;
}
const std::string& string() const
{
return _string;
}
const Position& position() const
{
return _position;
}
void readToken( int token )
{
if ( _token != token )
{
throw Error(_position, "expected token '%s', found '%s'", tokenString(token).c_str(), tokenString(_token).c_str());
}
next();
}
bool readIfToken( int token )
{
if ( _token == token )
{
next();
return true;
}
return false;
}
private:
Token getCharacters()
{
char delim = _input.get();
while ( _input.peek() != delim && _input.peek() != EOF )
{
_string += (char)_input.get();
}
if ( _input.peek() == EOF )
{
const Position position = { _position.line, _position.column + (unsigned)_string.length() + 1, _position.filename, nullptr };
throw Error(position, "expected %c", delim);
}
_input.get();
return Token::Characters;
}
Token getIdentifier()
{
static const std::map<std::string,Token> keywords =
{
std::make_pair("version", Token::Version),
std::make_pair("extension", Token::Extension),
std::make_pair("graph", Token::Graph),
std::make_pair("fragment", Token::Fragment),
std::make_pair("tensor", Token::Tensor),
std::make_pair("integer", Token::Integer),
std::make_pair("scalar", Token::Scalar),
std::make_pair("logical", Token::Logical),
std::make_pair("string", Token::String),
std::make_pair("true", Token::True),
std::make_pair("false", Token::False),
std::make_pair("for", Token::For),
std::make_pair("in", Token::In),
std::make_pair("if", Token::If),
std::make_pair("else", Token::Else),
std::make_pair("yield", Token::Yield),
std::make_pair("length_of", Token::LengthOf),
std::make_pair("shape_of", Token::ShapeOf),
std::make_pair("range_of", Token::RangeOf),
};
do
{
_string += _input.get();
}
while ( std::isalnum(_input.peek()) || _input.peek() == '_' );
auto it = keywords.find(_string);
return it == keywords.end() ? Token::Identifier : it->second;
}
Token getNumber()
{
bool real = false;
do
{
_string += _input.get();
if ( _input.peek() == '.' && !real )
{
_string += _input.get();
real = true;
}
}
while ( std::isdigit(_input.peek()) );
if ( _input.peek() == 'e' || _input.peek() == 'E' )
{
_string += _input.get();
if ( _input.peek() == '+' || _input.peek() == '-' )
{
_string += _input.get();
}
if ( !std::isdigit(_input.peek()) )
{
const Position position = { _position.line, _position.column + (unsigned)_string.length(), _position.filename, nullptr };
throw Error(position, "expected digit");
}
while ( std::isdigit(_input.peek()) )
{
_string += _input.get();
}
real = true;
}
return real ? Token::Fractional : Token::Decimal;
}
int getOperator()
{
int token = _input.get();
_string += (char)token;
if ( _input.peek() == '=' )
{
if ( token == '<' )
{
_string += (char)_input.get();
token = Le;
}
else if ( token == '>' )
{
_string += (char)_input.get();
token = Ge;
}
else if ( token == '=' )
{
_string += (char)_input.get();
token = Eq;
}
else if ( token == '!' )
{
_string += (char)_input.get();
token = Ne;
}
}
if ( token == '&' && _input.peek() == '&' )
{
_string += (char)_input.get();
token = And;
}
else if ( token == '|' && _input.peek() == '|' )
{
_string += (char)_input.get();
token = Or;
}
else if ( token == '-' && _input.peek() == '>' )
{
_string += (char)_input.get();
token = Arrow;
}
return token;
}
void skipSpace()
{
while ( std::isspace(_input.peek()) )
{
++_position.column;
char ch = _input.get();
if ( ch == '\r' || ch == '\n' )
{
++_position.line;
_position.column = 1;
}
if ( ch == '\r' && _input.peek() == '\n' )
{
_input.get();
}
}
}
void skipComment()
{
while ( _input.peek() == '#' )
{
while ( _input.peek() != '\n' && _input.peek() != '\r' && _input.peek() != EOF )
{
_input.get();
++_position.column;
}
skipSpace();
}
}
private:
std::istream& _input;
std::string _string;
Position _position;
int _token;
};
inline float getScalarValue( Lexer& lexer )
{
return (float)std::atof(lexer.string().c_str());
}
inline int getIntegerValue( Lexer& lexer )
{
return std::atoi(lexer.string().c_str());
}
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/parser.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_PARSER_H_
#define _NNEF_PARSER_H_
#include "value.h"
#include "lexer.h"
#include "prototype.h"
#include "dictionary.h"
#include <functional>
namespace nnef
{
class Parser
{
public:
typedef std::pair<int,int> version_t;
typedef std::vector<std::string> extensions_t;
enum Flags { KHR_ENABLE_FRAGMENT_DEFINITIONS = 0x1, KHR_ENABLE_OPERATOR_EXPRESSIONS = 0x2 };
public:
struct Callback
{
virtual ~Callback() {}
virtual void beginDocument( const std::string& filename, const version_t& version ) {}
virtual void endDocument( const std::string& filename ) {}
virtual bool handleExtension( const std::string& extension ) { return false; }
virtual void beginGraph( const Prototype& proto, const Dictionary<Prototype>& fragments ) {}
virtual void endGraph( const Prototype& proto, const Dictionary<Typename>& dtypes ) {}
virtual void operation( const Prototype& proto, const Dictionary<Value>& args, const Dictionary<Typename>& dtypes ) = 0;
};
public:
virtual ~Parser() {}
virtual void parse( std::istream& is, const char* filename, Callback& callback ) = 0;
protected:
static Typename getTypename( Lexer& lexer )
{
switch ( lexer.token() )
{
case Lexer::Integer:
return Typename::Integer;
case Lexer::Scalar:
return Typename::Scalar;
case Lexer::Logical:
return Typename::Logical;
case Lexer::String:
return Typename::String;
case '?':
return Typename::Generic;
default:
throw Error(lexer.position(), "expected type name, found '%s'", Lexer::tokenString(lexer.token()).c_str());
}
}
static version_t readVersion( Lexer& lexer )
{
lexer.readToken(Lexer::Version);
if ( lexer.token() != Lexer::Fractional )
{
throw Error(lexer.position(), "expected version number");
}
auto str = lexer.string();
const size_t dots = std::count(str.begin(), str.end(), '.');
bool isdigits = std::all_of(str.begin(), str.end(), []( char ch ){ return std::isdigit(ch) || ch == '.'; });
if ( !isdigits || dots != 1 )
{
throw Error(lexer.position(), "invalid version number format: %s", str.c_str());
}
lexer.next();
auto dot = str.find('.');
auto major = std::atoi(str.substr(0,dot).c_str());
auto minor = std::atoi(str.substr(dot+1).c_str());
static const version_t MaxSupportedVersion(1,0);
auto version = version_t(major,minor);
if ( version > MaxSupportedVersion )
{
throw Error(lexer.position(), "unsupported version %d.%d; maximum supported version is %d.%d",
(int)major, (int)minor, (int)MaxSupportedVersion.first, (int)MaxSupportedVersion.second);
}
lexer.readToken(';');
return version;
}
static extensions_t readExtensions( Lexer& lexer, std::function<bool( const std::string& )> handler )
{
extensions_t extensions;
while ( lexer.readIfToken(Lexer::Extension) )
{
do
{
auto position = lexer.position();
extensions.push_back(lexer.string());
lexer.readToken(Lexer::Identifier);
if ( !handler(extensions.back()) )
{
throw Error(position, "could not handle extension '%s'", extensions.back().c_str());
}
}
while ( lexer.readIfToken(',') );
lexer.readToken(';');
}
return extensions;
}
};
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/prototype.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_PROTOTYPE_H_
#define _NNEF_PROTOTYPE_H_
#include "typespec.h"
#include "value.h"
#include <vector>
#include <string>
#include <initializer_list>
namespace nnef
{
class Typed
{
public:
Typed( const std::string& name, const Type* type )
: _name(name), _type(type)
{
}
const std::string& name() const
{
return _name;
}
const Type* type() const
{
return _type;
}
private:
std::string _name;
const Type* _type;
};
class Param : public Typed
{
public:
Param( const std::string& name, const Type* type, const Value& defaultValue = Value::none() )
: Typed(name,type), _default(defaultValue)
{
}
const Value& defaultValue() const
{
return _default;
}
private:
Value _default;
};
typedef Typed Result;
class Prototype
{
private:
void initGeneric()
{
auto isGeneric = []( const Typed& typed ){ return typed.type()->isGeneric(); };
_hasGenericParams = std::any_of(_params.begin(), _params.end(), isGeneric);
_hasGenericResults = std::any_of(_results.begin(), _results.end(), isGeneric);
}
public:
Prototype( const std::string& name, std::initializer_list<Param> params, std::initializer_list<Result> results,
const PrimitiveType* genericParamDefault = nullptr )
: _name(name), _params(params), _results(results), _genericParamDefault(genericParamDefault)
{
initGeneric();
}
Prototype( const std::string& name, std::vector<Param>& params, std::vector<Result>& results,
const PrimitiveType* genericParamDefault = nullptr )
: _name(name), _params(std::move(params)), _results(std::move(results)), _genericParamDefault(genericParamDefault)
{
initGeneric();
}
const std::string& name() const
{
return _name;
}
const PrimitiveType* genericParamDefault() const
{
return _genericParamDefault;
}
size_t paramCount() const
{
return _params.size();
}
const Param& param( const size_t i ) const
{
return _params[i];
}
const Param* param( const std::string& name ) const
{
for ( auto& param : _params )
{
if ( param.name() == name )
{
return ¶m;
}
}
return nullptr;
}
size_t resultCount() const
{
return _results.size();
}
const Result& result( const size_t i ) const
{
return _results[i];
}
const Result* result( const std::string& name ) const
{
for ( auto& result : _results )
{
if ( result.name() == name )
{
return &result;
}
}
return nullptr;
}
bool hasGenericParams() const
{
return _hasGenericParams;
}
bool hasGenericResults() const
{
return _hasGenericResults;
}
bool isGeneric() const
{
return _hasGenericParams || _hasGenericResults;
}
private:
std::string _name;
std::vector<Param> _params;
std::vector<Result> _results;
bool _hasGenericParams;
bool _hasGenericResults;
const PrimitiveType* _genericParamDefault;
};
inline std::ostream& operator<<( std::ostream& os, const Typed& typed )
{
os << typed.name() << ": " << typed.type()->toString();
return os;
}
inline std::ostream& operator<<( std::ostream& os, const Prototype& proto )
{
os << proto.name();
if ( proto.isGeneric() )
{
os << "<?";
if ( proto.genericParamDefault() )
{
os << " = " << proto.genericParamDefault()->toString();
}
os << ">";
}
os << "( ";
for ( size_t i = 0; i < proto.paramCount(); ++i )
{
if ( i )
{
os << ", ";
}
os << proto.param(i);
}
os << " )";
os << " -> ";
os << "( ";
for ( size_t i = 0; i < proto.resultCount(); ++i )
{
if ( i )
{
os << ", ";
}
os << proto.result(i);
}
os << " )";
return os;
}
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/shapes.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_SHAPES_H_
#define _NNEF_SHAPES_H_
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <functional>
#include <algorithm>
#include <limits>
#include "value.h"
#include "error.h"
namespace nnef
{
typedef std::vector<int> Shape;
inline std::string to_string( const Shape& shape )
{
std::string str;
str += '[';
for ( size_t i = 0; i < shape.size(); ++i )
{
if ( i )
{
str += ',';
}
str += std::to_string(shape[i]);
}
str += ']';
return str;
}
inline Shape make_shape( const Value& arg, const size_t offset = 0 )
{
Shape shape = Shape(offset + arg.size(), 1);
for ( size_t i = 0; i < arg.size(); ++i )
{
shape[i + offset] = arg[i].integer();
}
return shape;
}
inline Shape make_padding_shape( const Value& arg, const size_t offset = 0 )
{
Shape padding(offset + arg.size(), 0);
for ( size_t i = 0; i < arg.size(); ++i )
{
padding[i + offset] = arg[i][0].integer() + arg[i][1].integer();
}
return padding;
}
inline size_t volume_of( const Shape& shape )
{
return std::accumulate(shape.begin(), shape.end(), (size_t)1, std::multiplies<size_t>());
}
inline size_t volume_of( const Shape& shape, const size_t offset, const size_t length )
{
return std::accumulate(shape.begin() + offset, shape.begin() + offset + length, (size_t)1, std::multiplies<size_t>());
}
inline bool broadcastable( const Shape& xShape, const Shape& yShape, const size_t n )
{
for ( size_t i = 0; i < n; ++i )
{
auto xi = i < xShape.size() ? xShape[i] : 1;
auto yi = i < yShape.size() ? yShape[i] : 1;
if ( !(xi == yi || xi == 1) )
{
return false;
}
}
return true;
}
inline bool broadcastable( const Shape& xShape, const Shape& yShape )
{
const size_t rank = std::max(xShape.size(), yShape.size());
return broadcastable(xShape, yShape, rank);
}
inline bool broadcast_compatible( const Shape& xShape, const Shape& yShape, const size_t n )
{
for ( size_t i = 0; i < n; ++i )
{
auto xi = i < xShape.size() ? xShape[i] : 1;
auto yi = i < yShape.size() ? yShape[i] : 1;
if ( !(xi == yi || xi == 1 || yi == 1) )
{
return false;
}
}
return true;
}
inline bool broadcast_compatible( const Shape& xShape, const Shape& yShape )
{
const size_t rank = std::max(xShape.size(), yShape.size());
return broadcast_compatible(xShape, yShape, rank);
}
inline bool axes_compatible_with_rank( const Value& axes, const size_t rank )
{
for ( size_t i = 0; i < axes.size(); ++i )
{
auto axis = axes[i].integer();
if ( axis < 0 || axis >= (Value::integer_t)rank )
{
return false;
}
}
return true;
}
inline bool contains_axis( const Value& axes, const size_t axis )
{
for ( size_t i = 0; i < axes.size(); ++i )
{
if ( axes[i].integer() == (Value::integer_t)axis )
{
return true;
}
}
return false;
}
template <typename T>
inline int sign( T val )
{
return (T(0) < val) - (val < T(0));
}
inline int ceil_div( int x, int y )
{
return y > 0 ? (x + y - 1) / y : (x + y + 1) / y;
}
template<typename T>
inline T downsize( const T input, const T size, const T padding, const T stride, const T dilation )
{
const T window = 1 + (size - 1) * dilation;
return sign(input) * ((std::abs(input) + padding - window) / stride + 1);
}
template<typename T>
inline T downsize( const T input, const T stride )
{
return sign(input) * ((std::abs(input) + stride - 1) / stride);
}
template<typename T>
inline T upsize( const T input, const T size, const T padding, const T stride, const T dilation )
{
const T window = 1 + (size - 1) * dilation;
return sign(input) * ((std::abs(input) - 1) * stride + window - padding);
}
template<typename T>
inline T upsize( const T input, const T stride )
{
return input * stride;
}
template<typename... Args>
inline void check( bool condition, const char* message, Args&&... args )
{
if ( !condition )
{
throw std::logic_error(Error::formatString(message, std::forward<Args>(args)...));
}
}
inline void check_axis_compatible_with_rank( const Value& axis, const size_t rank )
{
check(axis.integer() >= 0 && axis.integer() < (Value::integer_t)rank,
"axis must be in range [0,%d); found %d", (int)rank, (int)axis.integer());
}
inline void check_axes_compatible_with_rank( const Value& axes, const size_t rank )
{
check(axes_compatible_with_rank(axes, rank),
"axes must be in range [0,%d); found %s", (int)rank, axes.toString().c_str());
}
inline void check_range( const char* name, const Value& value, const Value::integer_t min )
{
if ( value.kind() == Value::Array || value.kind() == Value::Tuple )
{
for ( size_t i = 0; i < value.size(); ++i )
{
check_range(name, value[i], min);
}
}
else if ( value.kind() == Value::Integer )
{
check(value.integer() >= min, "'%s' must be >= %d (found %d)", name, min, (int)value.integer());
}
}
inline void check_rank( const char* name, const Value& value, const size_t rank )
{
check(value.size() == rank, "length of array '%s' must be %d to match rank of operation (found %d)",
name, (int)rank, (int)value.size());
}
inline Shape broadcast_shape( const Shape& xShape, const Shape& yShape, const size_t n )
{
const size_t rank = std::max(xShape.size(), yShape.size());
Shape zShape(rank);
for ( size_t i = 0; i < n; ++i )
{
auto xi = i < xShape.size() ? xShape[i] : 1;
auto yi = i < yShape.size() ? yShape[i] : 1;
zShape[i] = std::max(xi, yi);
}
return zShape;
}
inline Shape broadcast_shape( const Shape& xShape, const Shape& yShape )
{
const size_t rank = std::max(xShape.size(), yShape.size());
return broadcast_shape(xShape, yShape, rank);
}
inline Shape nullary_shape( const Value& shape )
{
return make_shape(shape);
}
inline Shape constant_shape( const Value& shape, const Value& value )
{
auto result = nullary_shape(shape);
check(value.size() == volume_of(result) || value.size() == 1,
"shape volume (%d) does not match number of values (%d)", (int)volume_of(result), (int)value.size());
return result;
}
inline Shape unary_shape( const Shape& shape )
{
return shape;
}
inline Shape binary_shape( const Shape& shape1, const Shape& shape2 )
{
check(broadcast_compatible(shape1, shape2),
"incompatible tensor shapes for broadcasting (%s vs %s)",
to_string(shape1).c_str(), to_string(shape2).c_str());
return broadcast_shape(shape1, shape2);
}
inline Shape asymmetric_binary_shape( const Shape& shape1, const Shape& shape2 )
{
check(broadcastable(shape2, shape1),
"cannot broadcast second argument shape (%s) to first argument shape (%s)",
to_string(shape2).c_str(), to_string(shape1).c_str());
return shape1;
}
inline Shape ternary_shape( const Shape& shape1, const Shape& shape2, const Shape& shape3 )
{
return binary_shape(binary_shape(shape1, shape2), shape3);
}
inline Shape reduce_shape( const Shape& input, const Value& axes )
{
check_axes_compatible_with_rank(axes, input.size());
Shape output = input;
for ( size_t i = 0; i < axes.size(); ++i )
{
auto axis = axes[i].integer();
output[axis] = 1;
}
return output;
}
inline Shape downsample_shape( const Shape& input, const Value& factor )
{
for ( size_t i = 0; i < factor.size(); ++i )
{
auto scale = factor[i].integer();
check(input[i+2] % scale == 0, "input extent (%d) must be divisible by factor (%d)", (int)input[i+2], (int)scale);
}
Shape output = input;
for ( size_t i = 0; i < factor.size(); ++i )
{
output[i+2] /= factor[i].integer();
}
return output;
}
inline Shape upsample_shape( const Shape& input, const Value& factor )
{
check_rank("factor", factor, input.size() - 2);
Shape output = input;
for ( size_t i = 0; i < factor.size(); ++i )
{
output[i+2] *= factor[i].integer();
}
return output;
}
inline Shape downsize_shape( const Shape& input, const Shape& kernel, const Shape& padding, const Shape& stride, const Shape& dilation,
const size_t offset )
{
Shape output(input.size());
for ( size_t i = offset; i < output.size(); ++i )
{
output[i] = padding.size() ? downsize(input[i], kernel[i], padding[i], stride[i], dilation[i]) : downsize(input[i], stride[i]);
}
return output;
}
inline Shape upsize_shape( const Shape& input, const Shape& kernel, const Shape& padding, const Shape& stride, const Shape& dilation,
const size_t offset )
{
Shape output(input.size());
for ( size_t i = offset; i < output.size(); ++i )
{
output[i] = padding.size() ? upsize(input[i], kernel[i], padding[i], stride[i], dilation[i]) : upsize(input[i], stride[i]);
}
return output;
}
inline Shape conv_like_shape( const Shape& input, const Shape& filter, const Shape& bias,
const Value& /*border*/, const Value& padding, const Value& stride, const Value& dilation,
const Value& groups, const Value& output_shape, const bool transposed )
{
auto rank = input.size();
if ( padding.size() )
{
check_rank("padding", padding, rank - 2);
}
if ( stride.size() )
{
check_rank("stride", stride, rank - 2);
}
if ( dilation.size() )
{
check_rank("dilation", dilation, rank - 2);
}
check_range("stride", stride, 1);
check_range("dilation", dilation, 1);
check_range("groups", groups, 0);
auto groupCount = groups.integer() != 0 ? groups.integer() : transposed && output_shape && output_shape.size() ? output_shape[1].integer() : input[1];
if ( transposed )
{
check(input[1] == filter[0], "filter batch (%d) does not match input channels (%d)",
(int)filter[0], (int)input[1]);
}
else
{
check(input[1] == filter[1] * groupCount, "filter channels (%d) does not match input channels (%d) times groups (%d)",
(int)filter[1], (int)input[1], (int)groupCount);
}
check(filter[0] % groupCount == 0, "filter batch (%d) must be divisible by groups (%d)", (int)filter[0], (int)groupCount);
check(bias.size() <= 2, "bias shape must be of rank at most 2, found %d", (int)bias.size());
if ( bias.size() == 2 )
{
check(bias[0] == 1, "bias shape must be singular for the batch dimension");
}
if ( bias.size() > 0 )
{
auto channels = transposed ? filter[1] * groupCount : filter[0];
check(bias.back() == channels || bias.back() == 1, "bias channels (%d) does not match output channels (%d)",
(int)bias.back(), (int)channels);
}
const Shape strideShape = make_shape(stride, stride.size() ? 2 : rank);
const Shape dilationShape = make_shape(dilation, dilation.size() ? 2 : rank);
const Shape paddingShape = padding.size() ? make_padding_shape(padding, 2) : Shape();
if ( output_shape && output_shape.size() )
{
const Shape outputShape = make_shape(output_shape);
check_rank("output_shape", output_shape, rank);
check_range("output_shape", output_shape, 1);
check(outputShape[0] == input[0], "output batch (%d) does not match input batch (%d)", (int)outputShape[0], (int)input[0]);
check(outputShape[1] == filter[1] * groupCount, "output channels (%d) does not match filter channels (%d) times groups (%d)",
(int)outputShape[1], (int)filter[1], (int)groupCount);
Shape expected = downsize_shape(outputShape, filter, paddingShape, strideShape, dilationShape, 2);
std::copy_n(input.begin(), 2, expected.begin());
check(input == expected, "expected input shape %s derived from output shape is incompatible with actual input shape %s",
to_string(expected).c_str(), to_string(input).c_str());
return outputShape;
}
if ( transposed )
{
auto output = upsize_shape(input, filter, paddingShape, strideShape, dilationShape, 2);
output[0] = input[0];
output[1] = filter[1] * groupCount;
return output;
}
else
{
auto output = downsize_shape(input, filter, paddingShape, strideShape, dilationShape, 2);
output[0] = input[0];
output[1] = filter[0];
return output;
}
}
inline Shape separable_conv_like_shape( const Shape& input, const Shape& plane_filter, const Shape& point_filter, const Shape& bias,
const Value& border, const Value& padding, const Value& stride, const Value& dilation,
const Value& groups, const Value& output_shape, const bool transposed )
{
for ( size_t i = 2; i < point_filter.size(); ++i )
{
check(point_filter[i] == 1, "point filter must have singular extents in spatial dimensions");
}
check(point_filter[1] == plane_filter[0], "channel dimension of point filter must equal batch dimension of plane filter");
check(plane_filter[1] == 1, "channel dimension of plane filter must be singular");
Shape filter = plane_filter;
filter[0] = point_filter[0];
filter[1] = transposed ? point_filter[1] : input[1];
return conv_like_shape(input, filter, bias, border, padding, stride, dilation, groups, output_shape, transposed);
}
inline Shape conv_shape( const Shape& input, const Shape& filter, const Shape& bias,
const Value& border, const Value& padding, const Value& stride, const Value& dilation,
const Value& groups )
{
return conv_like_shape(input, filter, bias, border, padding, stride, dilation, groups, Value::none(), false);
}
inline Shape deconv_shape( const Shape& input, const Shape& filter, const Shape& bias,
const Value& border, const Value& padding, const Value& stride, const Value& dilation,
const Value& output_shape, const Value& groups )
{
return conv_like_shape(input, filter, bias, border, padding, stride, dilation, groups, output_shape, true);
}
inline Shape separable_conv_shape( const Shape& input, const Shape& plane_filter, const Shape& point_filter, const Shape& bias,
const Value& border, const Value& padding, const Value& stride, const Value& dilation,
const Value& groups )
{
return separable_conv_like_shape(input, plane_filter, point_filter, bias, border, padding, stride, dilation, groups, Value::none(), false);
}
inline Shape separable_deconv_shape( const Shape& input, const Shape& plane_filter, const Shape& point_filter, const Shape& bias,
const Value& border, const Value& padding, const Value& stride, const Value& dilation,
const Value& output_shape, const Value& groups )
{
return separable_conv_like_shape(input, plane_filter, point_filter, bias, border, padding, stride, dilation, groups, output_shape, true);
}
inline Shape pool_like_shape( const Shape& input, const Value& size, const Value& /*border*/, const Value& padding,
const Value& stride, const Value& dilation, const Value& output_shape, const bool transposed )
{
auto rank = input.size();
check_rank("size", size, rank);
if ( padding.size() )
{
check_rank("padding", padding, rank);
}
if ( stride.size() )
{
check_rank("stride", stride, rank);
}
if ( dilation.size() )
{
check_rank("dilation", dilation, rank);
}
check_range("size", size, 1);
check_range("stride", stride, 1);
check_range("dilation", dilation, 1);
auto kernelShape = make_shape(size);
auto strideShape = make_shape(stride, stride.size() ? 0 : rank);
auto dilationShape = make_shape(dilation, dilation.size() ? 0 : rank);
auto paddingShape = padding.size() ? make_padding_shape(padding) : Shape();
if ( output_shape && output_shape.size() )
{
const Shape outputShape = make_shape(output_shape);
check_rank("output_shape", output_shape, rank);
check_range("output_shape", output_shape, 1);
const Shape expected = downsize_shape(outputShape, kernelShape, paddingShape, strideShape, dilationShape, 0);
check(input == expected, "expected input shape %s derived from output shape is incompatible with actual input shape %s",
to_string(expected).c_str(), to_string(input).c_str());
return outputShape;
}
if ( transposed )
{
return upsize_shape(input, kernelShape, paddingShape, strideShape, dilationShape, 0);
}
else
{
return downsize_shape(input, kernelShape, paddingShape, strideShape, dilationShape, 0);
}
}
inline Shape sample_like_shape( const Shape& input, const Shape& index, const Value& size, const Value& border, const Value& padding,
const Value& stride, const Value& dilation, const Value& output_shape, const bool transposed )
{
check(index == input, "index shape incompatible with input shape (%s vs %s)",
to_string(index).c_str(), to_string(input).c_str());
return pool_like_shape(input, size, border, padding, stride, dilation, output_shape, transposed);
}
inline Shape pool_shape( const Shape& input, const Value& size, const Value& border, const Value& padding,
const Value& stride, const Value& dilation )
{
return pool_like_shape(input, size, border, padding, stride, dilation, Value::none(), false);
}
inline Shape unpool_shape( const Shape& input, const Value& size, const Value& border, const Value& padding,
const Value& stride, const Value& dilation, const Value& output_shape )
{
return pool_like_shape(input, size, border, padding, stride, dilation, output_shape, true);
}
inline Shape sample_shape( const Shape& input, const Shape& index, const Value& size, const Value& border, const Value& padding,
const Value& stride, const Value& dilation )
{
return sample_like_shape(input, index, size, border, padding, stride, dilation, Value::none(), false);
}
inline Shape desample_shape( const Shape& input, const Shape& index, const Value& size, const Value& border, const Value& padding,
const Value& stride, const Value& dilation, const Value& output_shape )
{
return sample_like_shape(input, index, size, border, padding, stride, dilation, output_shape, true);
}
inline Shape normalize_shape_axes( const Shape& input, const Value& axes )
{
check_axes_compatible_with_rank(axes, input.size());
return input;
}
inline Shape normalize_shape_size( const Shape& input, const Value& size )
{
check_rank("size", size, input.size());
check_range("size", size, 1);
return input;
}
inline Shape batchnorm_shape( const Shape& input, const Shape& mean, const Shape& variance, const Shape& offset, const Shape& scale, const Value& /*epsilon*/ )
{
check(broadcastable(mean, input), "cannot broadcast 'mean' shape (%s) to 'input' shape (%s)",
to_string(mean).c_str(), to_string(input).c_str());
check(broadcastable(variance, input), "cannot broadcast 'variance' shape (%s) to 'input' shape (%s)",
to_string(variance).c_str(), to_string(input).c_str());
check(broadcastable(offset, input), "cannot broadcast 'offset' shape (%s) to 'input' shape (%s)",
to_string(offset).c_str(), to_string(input).c_str());
check(broadcastable(scale, input), "cannot broadcast 'scale' shape (%s) to 'input' shape (%s)",
to_string(scale).c_str(), to_string(input).c_str());
return input;
}
inline Shape roi_shape( const Shape& input, const Shape& rois, const Shape& index, const Value& size )
{
check_rank("output_size", size, input.size() - 2);
check_range("output_size", size, 1);
check(rois.size() == 2, "'rois' must be a rank-2 tensor");
check(index.size() == 1, "'batch_index' must be a rank-1 tensor");
check(rois[1] == 4, "rois must be of extent 4 along dimension 1 (found %d)", (int)rois[1]);
check(index[0] == rois[0], "'batch_index' must be of same length as dimension 0 of rois; found (%d vs %d)", (int)index[0], (int)rois[0]);
Shape output(input.size());
output[0] = rois[0];
output[1] = input[1];
for ( size_t i = 0; i < size.size(); ++i )
{
output[i+2] = (Shape::value_type)size[i].integer();
}
return output;
}
inline Shape roi_shape_resample( const Shape& input, const Shape& rois, const Shape& index, const Value& size, const Value& rate )
{
check_rank("sampling_rate", rate, input.size() - 2);
check_range("sampling_rate", rate, 1);
return roi_shape(input, rois, index, size);
}
inline Shape reshape_shape( const Shape& input, const Value& shape, const Value& axis_start, const Value& axis_count )
{
check_axis_compatible_with_rank(axis_start, input.size() + 1);
check_range("axis_count", axis_start, -1);
const size_t offset = axis_start.integer();
const size_t length = axis_count.integer() == -1 ? input.size() - axis_start.integer() : axis_count.integer();
check(offset + length <= input.size(), "'axis_start' + 'axis_count' must be in range [0,%d], found %d",
(int)input.size(), (int)(offset + length));
Shape output(input.begin(), input.begin() + offset);
size_t autoAxis = std::numeric_limits<size_t>::max();
for ( size_t i = 0; i < shape.size(); ++i )
{
auto s = shape[i].integer();
if ( s == 0 )
{
s = input[i + offset];
}
else if ( s == -1 )
{
check(autoAxis == std::numeric_limits<size_t>::max(), "shape may only contain at most one -1 value");
s = 1;
autoAxis = i + offset;
}
output.push_back(s);
}
output.insert(output.end(), input.begin() + offset + length, input.end());
auto inputVolume = volume_of(input, offset, length);
auto outputVolume = volume_of(output, offset, shape.size());
if ( autoAxis != std::numeric_limits<size_t>::max() )
{
check(inputVolume % outputVolume == 0, "automatic output shape (%s) incompatible with input shape (%s)", (int)outputVolume, (int)inputVolume);
output[autoAxis] = (Shape::value_type)(inputVolume / outputVolume);
}
else
{
check(inputVolume == outputVolume, "input volume (%d) does not equal output volume (%d)", (int)inputVolume, (int)outputVolume);
}
return output;
}
inline Shape transpose_shape( const Shape& input, const Value& axes )
{
std::vector<size_t> perm(axes.size());
for ( size_t i = 0; i < axes.size(); ++i )
{
perm[i] = axes[i].integer();
}
std::sort(perm.begin(), perm.end());
for ( size_t i = 0; i < perm.size(); ++i )
{
check(perm[i] == i, "'axes' array must contain a permutation of dimensions from 0 to %d-1", (int)perm.size());
}
Shape output = input;
for ( size_t i = 0; i < axes.size(); ++i )
{
auto j = axes[i].integer();
output[i] = input[j];
}
return output;
}
inline std::vector<Shape> split_shape( const Shape& value, const Value& axis, const Value& ratios )
{
check_axis_compatible_with_rank(axis, value.size());
check_range("ratios", ratios, 1);
auto idx = axis.integer();
Value::integer_t total = 0;
for ( size_t i = 0; i < ratios.size(); ++i )
{
total += ratios[i].integer();
}
check(value[idx] % total == 0, "sum of split ratios (%d) does not divide whole extent (%d)", (int)total, (int)value[idx]);
const Value::integer_t unit = value[idx] / total;
std::vector<Shape> values(ratios.size());
for ( size_t i = 0; i < values.size(); ++i )
{
Shape item = value;
item[idx] = unit * ratios[i].integer();
values[i] = item;
}
return values;
}
inline Shape concat_shape( const std::vector<Shape>& valuesShape, const Value& axis )
{
check(valuesShape.size() != 0, "input array must be non-empty");
Shape outputShape = valuesShape[0];
check_axis_compatible_with_rank(axis, outputShape.size());
const size_t idx = axis.integer();
bool compatibleShape = true;
for ( size_t i = 1; i < valuesShape.size(); ++i )
{
auto& partShape = valuesShape[i];
if ( partShape.size() != outputShape.size() )
{
compatibleShape = false;
break;
}
for ( size_t i = 0; i < outputShape.size(); ++i )
{
if ( i == idx )
{
outputShape[i] += partShape[i];
}
else
{
compatibleShape &= outputShape[i] == partShape[i];
}
}
}
check(compatibleShape, "incompatible tensor shapes in input array");
return outputShape;
}
inline Shape slice_shape( const Shape& input, const Value& axes, const Value& begin, const Value& end, const Value& stride )
{
check(begin.size() == axes.size() && end.size() == axes.size(), "'axes', 'begin' and 'end' arrays must have the same length");
check(stride.size() == 0 || stride.size() == axes.size(), "'stride' must have the same length as 'axes'");
check_axes_compatible_with_rank(axes, input.size());
Shape output = input;
for ( size_t i = 0; i < axes.size(); ++i )
{
auto axis = axes[i].integer();
auto extent = input[axis];
auto str = stride.size() ? stride[i].integer() : 1;
auto first = begin[i].integer();
if ( first < 0 )
{
first += extent;
}
auto last = end[i].integer();
if ( last < 0 )
{
last += extent;
}
else if ( last == 0 && str == 1 )
{
last = extent;
}
if ( first < 0 )
{
first = -1;
}
if ( first > extent )
{
first = extent;
}
if ( last < 0 )
{
last = -1;
}
if ( last > extent )
{
last = extent;
}
check(str != 0, "'stride' must be non-zero");
if ( str > 0 )
{
check(first >= 0 && last >= first, "slice range (%d:%d:%d) is invalid for axis %d",
(int)first, (int)last, (int)str, (int)axis);
}
else
{
check(first < extent && last <= first, "slice range (%d:%d:%d) is invalid for axis %d",
(int)first, (int)last, (int)str, (int)axis);
}
output[axis] = ceil_div(last - first, str);
}
return output;
}
inline Shape stack_shape( const std::vector<Shape>& inputs, const Value& axis )
{
auto& input = inputs[0];
bool compatibleShapes = std::all_of(inputs.begin() + 1, inputs.end(), [&]( const Shape& shape ){ return shape == input; });
check(compatibleShapes, "incompatible tensor shapes in input array");
Shape output(input.size() + 1);
check_axis_compatible_with_rank(axis, output.size());
const size_t idx = axis.integer();
for ( size_t i = 0; i < idx; ++i )
{
output[i] = input[i];
}
output[idx] = (Shape::value_type)inputs.size();
for ( size_t i = idx + 1; i < output.size(); ++i )
{
output[i] = input[i-1];
}
return output;
}
inline std::vector<Shape> unstack_shape( const Shape& input, const Value& axis )
{
check_axis_compatible_with_rank(axis, input.size());
const size_t idx = axis.integer();
Shape output(input.size() - 1);
for ( size_t i = 0; i < idx; ++i )
{
output[i] = input[i];
}
for ( size_t i = idx; i < output.size(); ++i )
{
output[i] = input[i+1];
}
return std::vector<Shape>(input[idx], output);
}
inline Shape squeeze_shape( const Shape& input, const Value& axes )
{
check_axes_compatible_with_rank(axes, input.size());
for ( size_t i = 0; i < axes.size(); ++i )
{
auto axis = axes[i].integer();
check(input[axis] == 1, "squeezed dimension is not singleton (has extent %d)", (int)input[axis]);
}
Shape output(input.size() - axes.size());
for ( size_t i = 0, k = 0; i < input.size(); ++i )
{
if ( !contains_axis(axes, i) )
{
output[k++] = input[i];
}
}
return output;
}
inline Shape unsqueeze_shape( const Shape& input, const Value& axes )
{
Shape output(input.size() + axes.size());
check_axes_compatible_with_rank(axes, output.size());
for ( size_t i = 0, k = 0; i < output.size(); ++i )
{
output[i] = contains_axis(axes, i) ? (Shape::value_type)1 : input[k++];
}
return output;
}
inline Shape tile_shape( const Shape& input, const Value& repeats )
{
check_rank("repeats", repeats, input.size());
check_range("repeats", repeats, 1);
Shape output(input.size());
for ( size_t i = 0; i < output.size(); ++i )
{
output[i] = input[i] * repeats[i].integer();
}
return output;
}
inline Shape pad_shape( const Shape& input, const Value& padding )
{
check_rank("padding", padding, input.size());
Shape output(input.size());
for ( size_t i = 0; i < output.size(); ++i )
{
output[i] = padding[i][0].integer() + input[i] + padding[i][1].integer();
}
return output;
}
inline Shape gather_shape( const Shape& input, const Shape& indices, const Value& axis )
{
check_axis_compatible_with_rank(axis, input.size());
const size_t idx = axis.integer();
Shape output(input.size() + indices.size() - 1);
std::copy_n(input.begin(), idx, output.begin());
std::copy_n(indices.begin(), indices.size(), output.begin() + idx);
std::copy(input.begin() + idx + 1, input.end(), output.begin() + idx + indices.size());
return output;
}
inline Shape matmul_shape( const Shape& A, const Shape& B, const Value& trA, const Value& trB )
{
check(A.size() == B.size(), "rank mismatch for A and B (%d vs %d)", (int)A.size(), (int)B.size());
auto rank = A.size();
check(rank >= 2, "rank of A and B must be at least 2, found %d", (int)rank);
auto batch_dims = rank - 2;
check(broadcast_compatible(A, B, batch_dims),
"incompatible tensor shapes for broadcasting first %d dimensions (%s vs %s)",
(int)batch_dims, to_string(A).c_str(), to_string(B).c_str());
auto i0 = batch_dims + 0;
auto i1 = batch_dims + 1;
auto m = trA.logical() ? A[i1] : A[i0];
auto n = trB.logical() ? B[i0] : B[i1];
auto kA = trA.logical() ? A[i0] : A[i1];
auto kB = trB.logical() ? B[i1] : B[i0];
check(kA == kB, "inner dimensions must agree (%d vs %d)", (int)kA, (int)kB);
Shape C = broadcast_shape(A, B, batch_dims);
C[i0] = m;
C[i1] = n;
return C;
}
inline Shape linear_shape( const Shape& input, const Shape& filter, const Shape& bias )
{
check(input.size() == 2, "input shape must be of rank 2 (found %d)", (int)input.size());
check(filter.size() == 2, "filter shape must be of rank 2 (found %d)", (int)filter.size());
check(input[1] == filter[1], "inner dimensions must agree (%d vs %d)", (int)input[1], (int)filter[1]);
if ( bias.size() )
{
check(bias[1] == filter[0], "bias channels (%d) does not match filter count (%d)", (int)bias[1], (int)filter[0]);
}
return Shape({ input[0], filter[0] });
}
inline Shape update_shape( const Shape& variable, const Shape& value )
{
check(value == variable, "updated shape %s does not equal variable shape %s", to_string(value).c_str(), to_string(variable).c_str());
return variable;
}
inline Shape softmax_shape( const Shape& inputShape, const Value& axes )
{
check_axes_compatible_with_rank(axes, inputShape.size());
return inputShape;
}
inline std::vector<Shape> copy_n_shape( const Shape& shape, const Value& times )
{
check_range("times", times, 1);
return std::vector<Shape>(times.integer(), shape);
}
inline Shape add_n_shape( const std::vector<Shape>& inputs )
{
check(inputs.size() != 0, "input array must be non-empty");
auto& shape = inputs[0];
for ( size_t i = 1; i < inputs.size(); ++i )
{
check(inputs[i] == shape, "incompatible item shapes in array (%s vs %s)", to_string(shape).c_str(), to_string(inputs[i]).c_str());
}
return shape;
}
inline Shape quantize_shape( const Shape& input, const Shape& min, const Shape& max, const Value& bits )
{
check(broadcastable(min, input), "cannot broadcast 'min' shape (%s) to 'input' shape (%s)",
to_string(min).c_str(), to_string(input).c_str());
check(broadcastable(max, input), "cannot broadcast 'max' shape (%s) to 'input' shape (%s)",
to_string(max).c_str(), to_string(input).c_str());
check_range("bits", bits, 0);
return input;
}
inline Shape linear_quantize_shape( const Shape& input, const Shape& min, const Shape& max, const Value& bits )
{
return quantize_shape(input, min, max, bits);
}
inline Shape logarithmic_quantize_shape( const Shape& input, const Shape& max, const Value& bits )
{
return quantize_shape(input, Shape(), max, bits);
}
inline Shape zero_point_linear_quantize_shape( const Shape& input, const Shape& zero_point, const Shape& scale, const Value& bits )
{
check(broadcastable(zero_point, input), "cannot broadcast 'zero_point' shape (%s) to 'input' shape (%s)",
to_string(zero_point).c_str(), to_string(input).c_str());
check(broadcastable(scale, input), "cannot broadcast 'scale' shape (%s) to 'input' shape (%s)",
to_string(scale).c_str(), to_string(input).c_str());
check_range("bits", bits, 0);
return input;
}
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/typespec.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_TYPESPEC_H_
#define _NNEF_TYPESPEC_H_
#include <map>
#include <memory>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <initializer_list>
namespace nnef
{
enum class Typename { Integer, Scalar, Logical, String, Generic };
inline const char* toString( const Typename& name )
{
static const char* strings[] =
{
"integer", "scalar", "logical", "string", "?"
};
return strings[(size_t)name];
}
inline Typename fromString( const std::string& str )
{
static const std::map<std::string,Typename> typenames =
{
{ "integer", Typename::Integer },
{ "scalar", Typename::Scalar },
{ "logical", Typename::Logical },
{ "string", Typename::String },
};
return typenames.at(str);
}
class Type
{
public:
enum Kind { Primitive, Tensor, Array, Tuple };
public:
virtual ~Type() {}
virtual Kind kind() const = 0;
virtual bool isAttribute() const = 0;
virtual bool isGeneric() const = 0;
virtual std::string toString() const = 0;
};
class PrimitiveType : public Type
{
public:
PrimitiveType( const Typename name )
: _name(name)
{
}
Typename name() const
{
return _name;
}
virtual Kind kind() const
{
return Primitive;
}
virtual bool isAttribute() const
{
return true;
}
virtual bool isGeneric() const
{
return _name == Typename::Generic;
}
virtual std::string toString() const
{
return nnef::toString(_name);
}
private:
Typename _name;
};
class TensorType : public Type
{
public:
TensorType( const Type* dataType )
: _dataType(dataType)
{
}
const Type* dataType() const
{
return _dataType;
}
virtual Kind kind() const
{
return Tensor;
}
virtual std::string toString() const
{
return _dataType ? "tensor<" + _dataType->toString() + ">" : "tensor<>";
}
virtual bool isAttribute() const
{
return false;
}
virtual bool isGeneric() const
{
return _dataType && _dataType->isGeneric();
}
private:
const Type* _dataType;
};
class ArrayType : public Type
{
public:
ArrayType( const Type* itemType )
: _itemType(itemType)
{
}
const Type* itemType() const
{
return _itemType;
}
virtual Kind kind() const
{
return Array;
}
virtual std::string toString() const
{
return _itemType ? _itemType->toString() + "[]" : "[]";
}
virtual bool isAttribute() const
{
return _itemType && _itemType->isAttribute();
}
virtual bool isGeneric() const
{
return _itemType && _itemType->isGeneric();
}
private:
const Type* _itemType;
};
class TupleType : public Type
{
public:
TupleType( const std::vector<const Type*>& itemTypes )
: _itemTypes(itemTypes)
{
}
TupleType( const std::initializer_list<const Type*>& itemTypes )
: _itemTypes(itemTypes)
{
}
size_t size() const
{
return _itemTypes.size();
}
const Type* itemType( const size_t i ) const
{
return _itemTypes[i];
}
virtual Kind kind() const
{
return Tuple;
}
virtual bool isAttribute() const
{
return std::all_of(_itemTypes.begin(), _itemTypes.end(), []( const Type* type ){ return type->isAttribute(); });
}
virtual bool isGeneric() const
{
return std::any_of(_itemTypes.begin(), _itemTypes.end(), []( const Type* type ){ return type->isGeneric(); });
}
virtual std::string toString() const
{
std::string str;
str += '(';
for ( size_t i = 0; i < _itemTypes.size(); ++i )
{
if ( i )
{
str += ',';
}
str += _itemTypes[i]->toString();
}
str += ')';
return str;
}
private:
std::vector<const Type*> _itemTypes;
};
inline const PrimitiveType* primitiveType( const Typename name )
{
static const PrimitiveType types[] =
{
PrimitiveType(Typename::Integer),
PrimitiveType(Typename::Scalar),
PrimitiveType(Typename::Logical),
PrimitiveType(Typename::String),
PrimitiveType(Typename::Generic),
};
return &types[(size_t)name];
}
inline const TensorType* tensorType( const Typename name )
{
static const TensorType types[] =
{
TensorType(primitiveType(Typename::Integer)),
TensorType(primitiveType(Typename::Scalar)),
TensorType(primitiveType(Typename::Logical)),
TensorType(primitiveType(Typename::String)),
TensorType(primitiveType(Typename::Generic)),
};
return &types[(size_t)name];
}
inline const TensorType* tensorType()
{
static const TensorType type(nullptr);
return &type;
}
inline const Type* arrayType( const Type* itemType )
{
static std::map<const Type*,ArrayType> types;
auto it = types.lower_bound(itemType);
if ( it == types.end() || it->first != itemType )
{
it = types.emplace_hint(it, itemType, itemType);
}
return &it->second;
}
inline const Type* tupleType( const std::vector<const Type*>& itemTypes )
{
static std::map<std::vector<const Type*>,TupleType> types;
auto it = types.lower_bound(itemTypes);
if ( it == types.end() || it->first != itemTypes )
{
it = types.emplace_hint(it, itemTypes, itemTypes);
}
return &it->second;
}
} // namespace nnef
#endif
================================================
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/typeutils.h
================================================
/*
* Copyright (c) 2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NNEF_TYPEUTILS_H_
#define _NNEF_TYPEUTILS_H_
#include "typespec.h"
#include "prototype.h"
#include "dictionary.h"
#include <cassert>
namespace nnef
{
inline bool isCastable( const Type* type1, const Type* type2, bool allowPrimitiveToTensor = true, bool allowArrayToTensor = false )
{
if ( type1 == type2 )
{
return true;
}
if ( type1->kind() == type2->kind() )
{
switch ( type1->kind() )
{
case Type::Primitive:
{
auto primitiveType1 = static_cast<const PrimitiveType*>(type1);
auto primitiveType2 = static_cast<const PrimitiveType*>(type2);
return primitiveType1->name() == primitiveType2->name() || primitiveType2->name() == Typename::Generic;
}
case Type::Tensor:
{
auto tensorType1 = static_cast<const TensorType*>(type1);
auto tensorType2 = static_cast<const TensorType*>(type2);
if ( tensorType1->dataType() && tensorType2->dataType() )
{
return isCastable(tensorType1->dataType(), tensorType2->dataType(), allowPrimitiveToTensor, allowArrayToTensor);
}
else
{
return !tensorType2->dataType();
}
}
case Type::Array:
{
auto arrayType1 = static_cast<const ArrayType*>(type1);
auto arrayType2 = static_cast<const ArrayType*>(type2);
if ( arrayType1->itemType() && arrayType2->itemType() )
{
return isCastable(arrayType1->itemType(), arrayType2->itemType(), allowPrimitiveToTensor, allowArrayToTensor);
}
else
{
return !arrayType1->itemType();
}
}
case Type::Tuple:
{
auto tupleType1 = static_cast<const TupleType*>(type1);
auto tupleType2 = static_cast<const TupleType*>(type2);
if ( tupleType1->size() != tupleType2->size() )
{
return false;
}
for ( size_t i = 0; i < tupleType1->size(); ++i )
{
if ( !isCastable(tupleType1->itemType(i), tupleType2->itemType(i), allowPrimitiveToTensor, allowArrayToTensor) )
{
return false;
}
}
return true;
}
}
}
else if ( type1->kind() == Type::Primitive && type2->kind() == Type::Tensor && allowPrimitiveToTensor )
{
auto tensorType = static_cast<const TensorType*>(type2);
return !tensorType->dataType() || isCastable(type1, tensorType->dataType());
}
else if ( type1->kind() == Type::Array && type2->kind() == Type::Tensor && allowArrayToTensor )
{
auto arrayType = static_cast<const ArrayType*>(type1);
auto itemType = arrayType->itemType();
while ( itemType->kind() != Type::Primitive )
{
if ( itemType->kind() != Type::Array )
{
return false;
}
itemType = static_cast<const ArrayType*>(itemType)->itemType();
}
auto tensorType = static_cast<const TensorType*>(type2);
return !tensorType->dataType() || isCastable(itemType, tensorType->dataType());
}
return false;
}
inline const Type* commonType( const Type* type1, const Type* type2 )
{
if ( isCastable(type1, type2) )
{
return type2;
}
else if ( isCastable(type2, type1) )
{
return type1;
}
return nullptr;
}
inline const Type* bindDataType( const Type* paramType, const PrimitiveType* dataType )
{
if ( !paramType->isGeneric() || dataType == primitiveType(Typename::Generic) )
{
return paramType;
}
switch ( paramType->kind() )
{
case Type::Primitive:
{
return paramType == primitiveType(Typename::Generic) ? dataType : paramType;
}
case Type::Tensor:
{
auto tensor = static_cast<const TensorType*>(paramType);
return tensor->dataType() == primitiveType(Typename::Generic) ? tensorType(dataType->name()) : paramType;
}
case Type::Array:
{
auto array = static_cast<const ArrayType*>(paramType);
return array->itemType() ? arrayType(bindDataType(array->itemType(), dataType)) : paramType;
}
case Type::Tuple:
{
auto tuple = static_cast<const TupleType*>(paramType);
std::vector<const Type*> itemTypes(tuple->size());
for ( size_t i = 0; i < tuple->size(); ++i )
{
itemTypes[i] = bindDataType(tuple->itemType(i), dataType);
}
return tupleType(itemTypes);
}
}
assert(false);
return nullptr;
}
inline void deduceDataType( const Type* paramType, const Type* argType, const PrimitiveType*& dataType )
{
if ( paramType->kind() == argType->kind() )
{
switch ( paramType->kind() )
{
case Type::Primitive:
{
if ( paramType->isGeneric() )
{
auto primitiveType = static_cast<const PrimitiveType*>(argType);
if ( !dataType )
{
dataType = primitiveType;
}
else if ( dataType != argType )
{
throw std::make_pair(dataType->name(), primitiveType->name());
}
}
break;
}
case Type::Tensor:
{
auto tensorType1 = static_cast<const TensorType*>(paramType);
auto tensorType2 = static_cast<const TensorType*>(argType);
if ( tensorType1->dataType() && tensorType2->dataType() )
{
deduceDataType(tensorType1->dataType(), tensorType2->dataType(), dataType);
}
break;
}
case Type::Array:
{
auto arrayType1 = static_cast<const ArrayType*>(paramType);
auto arrayType2 = static_cast<const ArrayType*>(argType);
if ( arrayType1->itemType() && arrayTyp
gitextract_brhyl024/
├── .github/
│ └── workflows/
│ ├── build_nnef.yml
│ └── build_nnef_tools.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── README.md
├── _config.yml
├── fix_nnef_binary_size.py
├── models/
│ └── README.md
├── nnef-pyproject/
│ ├── README.md
│ ├── cpp_api.md
│ ├── examples/
│ │ ├── alexnet.txt
│ │ ├── googlenet.txt
│ │ ├── resnet.txt
│ │ ├── samples/
│ │ │ ├── sample.py
│ │ │ ├── sample_ext.py
│ │ │ └── sample_gen.py
│ │ └── vgg.txt
│ ├── nnef/
│ │ ├── __init__.py
│ │ ├── binary.py
│ │ ├── cpp/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── include/
│ │ │ │ ├── cnnef.h
│ │ │ │ ├── nnef/
│ │ │ │ │ ├── common/
│ │ │ │ │ │ ├── binary.h
│ │ │ │ │ │ ├── dictionary.h
│ │ │ │ │ │ ├── error.h
│ │ │ │ │ │ ├── lexer.h
│ │ │ │ │ │ ├── parser.h
│ │ │ │ │ │ ├── prototype.h
│ │ │ │ │ │ ├── shapes.h
│ │ │ │ │ │ ├── typespec.h
│ │ │ │ │ │ ├── typeutils.h
│ │ │ │ │ │ └── value.h
│ │ │ │ │ ├── comp/
│ │ │ │ │ │ ├── comp_parser.h
│ │ │ │ │ │ ├── evaluation.h
│ │ │ │ │ │ ├── expression.h
│ │ │ │ │ │ ├── fragment.h
│ │ │ │ │ │ └── stdlib_source.h
│ │ │ │ │ ├── flat/
│ │ │ │ │ │ ├── flat_parser.h
│ │ │ │ │ │ ├── quant_parser.h
│ │ │ │ │ │ └── stdlib_protos.h
│ │ │ │ │ └── runtime/
│ │ │ │ │ ├── execution.h
│ │ │ │ │ ├── ndrange.h
│ │ │ │ │ └── operations.h
│ │ │ │ └── nnef.h
│ │ │ ├── infer.cpp
│ │ │ ├── sample.cpp
│ │ │ └── src/
│ │ │ ├── cnnef.cpp
│ │ │ └── nnef.cpp
│ │ ├── nnef.cpp
│ │ ├── parser.py
│ │ ├── printer.py
│ │ ├── shapes.py
│ │ └── validate.py
│ ├── package_info.md
│ ├── pyproject.toml
│ ├── setup.py
│ ├── stdlib.nnef
│ └── tests/
│ └── test.py
└── nnef_tools-pyproject/
├── LICENSE
├── README.md
├── custom/
│ ├── composite_export_example.py
│ ├── custom_operators_example.py
│ ├── custom_optimizers_example.py
│ ├── custom_transforms_example.py
│ ├── onnx_custom_export_example.py
│ └── onnx_custom_transforms_example.py
├── nnef_tools/
│ ├── __init__.py
│ ├── conversion/
│ │ ├── __init__.py
│ │ ├── converter.py
│ │ ├── nnef_to_onnx.py
│ │ ├── nnef_to_tf.py
│ │ ├── nnef_to_tflite.py
│ │ ├── onnx_to_nnef.py
│ │ ├── tf_to_nnef.py
│ │ └── tflite_to_nnef.py
│ ├── convert.py
│ ├── execute.py
│ ├── execution/
│ │ ├── __init__.py
│ │ └── tvm/
│ │ ├── __init__.py
│ │ └── nnef_frontend/
│ │ ├── __init__.py
│ │ ├── relax/
│ │ │ ├── __init__.py
│ │ │ ├── nnef_frontend.py
│ │ │ └── nnef_ops.py
│ │ └── relay/
│ │ ├── __init__.py
│ │ ├── from_nnef.py
│ │ └── nnef_ops.py
│ ├── generate.py
│ ├── gmac.py
│ ├── image_tensor.py
│ ├── interpreter/
│ │ ├── __init__.py
│ │ └── pytorch/
│ │ ├── __init__.py
│ │ ├── nnef_module.py
│ │ └── nnef_operators.py
│ ├── io/
│ │ ├── __init__.py
│ │ ├── caffe2/
│ │ │ ├── __init__.py
│ │ │ ├── caffe/
│ │ │ │ ├── __init__.py
│ │ │ │ └── proto/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── caffe.proto
│ │ │ │ └── caffe_pb2.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ ├── nnef/
│ │ │ ├── __init__.py
│ │ │ ├── helpers.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ ├── onnx/
│ │ │ ├── __init__.py
│ │ │ ├── reader.py
│ │ │ └── writer.py
│ │ └── tf/
│ │ ├── __init__.py
│ │ ├── graphdef/
│ │ │ ├── __init__.py
│ │ │ ├── composite.py
│ │ │ ├── protobuf.py
│ │ │ ├── reader.py
│ │ │ ├── utils.py
│ │ │ └── writer.py
│ │ └── lite/
│ │ ├── __init__.py
│ │ ├── flatbuffers/
│ │ │ ├── AbsOptions.py
│ │ │ ├── ActivationFunctionType.py
│ │ │ ├── AddNOptions.py
│ │ │ ├── AddOptions.py
│ │ │ ├── ArgMaxOptions.py
│ │ │ ├── ArgMinOptions.py
│ │ │ ├── BatchMatMulOptions.py
│ │ │ ├── BatchToSpaceNDOptions.py
│ │ │ ├── BidirectionalSequenceLSTMOptions.py
│ │ │ ├── BidirectionalSequenceRNNOptions.py
│ │ │ ├── Buffer.py
│ │ │ ├── BuiltinOperator.py
│ │ │ ├── BuiltinOptions.py
│ │ │ ├── CallOptions.py
│ │ │ ├── CastOptions.py
│ │ │ ├── CombinerType.py
│ │ │ ├── ConcatEmbeddingsOptions.py
│ │ │ ├── ConcatenationOptions.py
│ │ │ ├── Conv2DOptions.py
│ │ │ ├── CosOptions.py
│ │ │ ├── CustomOptionsFormat.py
│ │ │ ├── CustomQuantization.py
│ │ │ ├── DensifyOptions.py
│ │ │ ├── DepthToSpaceOptions.py
│ │ │ ├── DepthwiseConv2DOptions.py
│ │ │ ├── DequantizeOptions.py
│ │ │ ├── DimensionMetadata.py
│ │ │ ├── DimensionType.py
│ │ │ ├── DivOptions.py
│ │ │ ├── EmbeddingLookupSparseOptions.py
│ │ │ ├── EqualOptions.py
│ │ │ ├── ExpOptions.py
│ │ │ ├── ExpandDimsOptions.py
│ │ │ ├── FakeQuantOptions.py
│ │ │ ├── FillOptions.py
│ │ │ ├── FloorDivOptions.py
│ │ │ ├── FloorModOptions.py
│ │ │ ├── FullyConnectedOptions.py
│ │ │ ├── FullyConnectedOptionsWeightsFormat.py
│ │ │ ├── GatherNdOptions.py
│ │ │ ├── GatherOptions.py
│ │ │ ├── GreaterEqualOptions.py
│ │ │ ├── GreaterOptions.py
│ │ │ ├── HardSwishOptions.py
│ │ │ ├── IfOptions.py
│ │ │ ├── Int32Vector.py
│ │ │ ├── L2NormOptions.py
│ │ │ ├── LSHProjectionOptions.py
│ │ │ ├── LSHProjectionType.py
│ │ │ ├── LSTMKernelType.py
│ │ │ ├── LSTMOptions.py
│ │ │ ├── LeakyReluOptions.py
│ │ │ ├── LessEqualOptions.py
│ │ │ ├── LessOptions.py
│ │ │ ├── LocalResponseNormalizationOptions.py
│ │ │ ├── LogSoftmaxOptions.py
│ │ │ ├── LogicalAndOptions.py
│ │ │ ├── LogicalNotOptions.py
│ │ │ ├── LogicalOrOptions.py
│ │ │ ├── MatrixDiagOptions.py
│ │ │ ├── MatrixSetDiagOptions.py
│ │ │ ├── MaximumMinimumOptions.py
│ │ │ ├── Metadata.py
│ │ │ ├── MirrorPadMode.py
│ │ │ ├── MirrorPadOptions.py
│ │ │ ├── Model.py
│ │ │ ├── MulOptions.py
│ │ │ ├── NegOptions.py
│ │ │ ├── NonMaxSuppressionV4Options.py
│ │ │ ├── NonMaxSuppressionV5Options.py
│ │ │ ├── NotEqualOptions.py
│ │ │ ├── OneHotOptions.py
│ │ │ ├── Operator.py
│ │ │ ├── OperatorCode.py
│ │ │ ├── PackOptions.py
│ │ │ ├── PadOptions.py
│ │ │ ├── PadV2Options.py
│ │ │ ├── Padding.py
│ │ │ ├── Pool2DOptions.py
│ │ │ ├── PowOptions.py
│ │ │ ├── QuantizationDetails.py
│ │ │ ├── QuantizationParameters.py
│ │ │ ├── QuantizeOptions.py
│ │ │ ├── RNNOptions.py
│ │ │ ├── RangeOptions.py
│ │ │ ├── RankOptions.py
│ │ │ ├── ReducerOptions.py
│ │ │ ├── ReshapeOptions.py
│ │ │ ├── ResizeBilinearOptions.py
│ │ │ ├── ResizeNearestNeighborOptions.py
│ │ │ ├── ReverseSequenceOptions.py
│ │ │ ├── ReverseV2Options.py
│ │ │ ├── SVDFOptions.py
│ │ │ ├── ScatterNdOptions.py
│ │ │ ├── SegmentSumOptions.py
│ │ │ ├── SelectOptions.py
│ │ │ ├── SelectV2Options.py
│ │ │ ├── SequenceRNNOptions.py
│ │ │ ├── ShapeOptions.py
│ │ │ ├── SkipGramOptions.py
│ │ │ ├── SliceOptions.py
│ │ │ ├── SoftmaxOptions.py
│ │ │ ├── SpaceToBatchNDOptions.py
│ │ │ ├── SpaceToDepthOptions.py
│ │ │ ├── SparseIndexVector.py
│ │ │ ├── SparseToDenseOptions.py
│ │ │ ├── SparsityParameters.py
│ │ │ ├── SplitOptions.py
│ │ │ ├── SplitVOptions.py
│ │ │ ├── SquareOptions.py
│ │ │ ├── SquaredDifferenceOptions.py
│ │ │ ├── SqueezeOptions.py
│ │ │ ├── StridedSliceOptions.py
│ │ │ ├── SubGraph.py
│ │ │ ├── SubOptions.py
│ │ │ ├── Tensor.py
│ │ │ ├── TensorType.py
│ │ │ ├── TileOptions.py
│ │ │ ├── TopKV2Options.py
│ │ │ ├── TransposeConvOptions.py
│ │ │ ├── TransposeOptions.py
│ │ │ ├── Uint16Vector.py
│ │ │ ├── Uint8Vector.py
│ │ │ ├── UnidirectionalSequenceLSTMOptions.py
│ │ │ ├── UniqueOptions.py
│ │ │ ├── UnpackOptions.py
│ │ │ ├── WhereOptions.py
│ │ │ ├── WhileOptions.py
│ │ │ ├── ZerosLikeOptions.py
│ │ │ ├── __init__.py
│ │ │ └── schema.fbs
│ │ ├── helpers.py
│ │ ├── reader.py
│ │ └── writer.py
│ ├── model/
│ │ ├── __init__.py
│ │ ├── graph.py
│ │ └── utils.py
│ ├── operation_mapping.md
│ ├── optimization/
│ │ ├── __init__.py
│ │ ├── nnef_optimizer.py
│ │ ├── onnx_optimizer.py
│ │ ├── tf_optimizer.py
│ │ └── tflite_optimizer.py
│ ├── quantize.py
│ ├── random_tensor.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── stdio.py
│ │ └── types.py
│ └── visualize.py
├── package_info.md
├── pyproject.toml
└── tests/
└── conversion/
├── graphdef_test.py
├── onnx_test.py
└── tflite_test.py
Showing preview only (268K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2995 symbols across 217 files)
FILE: fix_nnef_binary_size.py
function fix_nnef_binary (line 20) | def fix_nnef_binary(in_fn, out_fn):
function fix_nnef_binaries (line 45) | def fix_nnef_binaries(in_path, out_path):
FILE: nnef-pyproject/examples/samples/sample_ext.py
function shuffle_shape (line 18) | def shuffle_shape(input, groups):
FILE: nnef-pyproject/nnef/__init__.py
function load_graph (line 41) | def load_graph(path, stdlib=None, lowered=None, load_variables=True):
function save_graph (line 73) | def save_graph(graph, path, annotate_shapes=False):
class Session (line 100) | class Session:
method __init__ (line 102) | def __init__(self, path, stdlib=None, lowered=None):
method __enter__ (line 105) | def __enter__(self):
method __exit__ (line 108) | def __exit__(self, exc_type, exc_val, exc_tb):
method __call__ (line 111) | def __call__(self, *inputs):
FILE: nnef-pyproject/nnef/binary.py
class ItemType (line 21) | class ItemType:
function _numpy_dtype_split (line 30) | def _numpy_dtype_split(dtype):
function _numpy_dtype_make (line 51) | def _numpy_dtype_make(item_type, bits):
function _rank_of (line 83) | def _rank_of(shape):
function _tofile (line 93) | def _tofile(data, file):
function _fromfile (line 102) | def _fromfile(file, dtype, count):
function write_tensor (line 113) | def write_tensor(file, tensor, quantized=False, version=(1, 0)):
function read_tensor (line 145) | def read_tensor(file, return_quantization=False):
function _write_tensor_provisional (line 193) | def _write_tensor_provisional(file, tensor, version=(1, 0)):
function _read_tensor_provisional (line 210) | def _read_tensor_provisional(file):
FILE: nnef-pyproject/nnef/cpp/include/nnef.h
function namespace (line 29) | namespace nnef
type Tensor (line 60) | struct Tensor
type Operation (line 74) | struct Operation
type Graph (line 87) | struct Graph
type std (line 170) | typedef std::function<void( const Operation& op, Graph& graph )> ShapeFunc;
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/binary.h
function namespace (line 29) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/dictionary.h
function namespace (line 24) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/error.h
function namespace (line 25) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/lexer.h
function namespace (line 27) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/parser.h
function namespace (line 27) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/prototype.h
function namespace (line 27) | namespace nnef
function Result (line 143) | const Result& result( const size_t i ) const
function Result (line 148) | const Result* result( const std::string& name ) const
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/shapes.h
function namespace (line 31) | namespace nnef
function volume_of (line 75) | inline size_t volume_of( const Shape& shape )
function volume_of (line 80) | inline size_t volume_of( const Shape& shape, const size_t offset, const ...
function broadcastable (line 85) | inline bool broadcastable( const Shape& xShape, const Shape& yShape, con...
function broadcastable (line 99) | inline bool broadcastable( const Shape& xShape, const Shape& yShape )
function broadcast_compatible (line 105) | inline bool broadcast_compatible( const Shape& xShape, const Shape& ySha...
function broadcast_compatible (line 119) | inline bool broadcast_compatible( const Shape& xShape, const Shape& ySha...
function axes_compatible_with_rank (line 125) | inline bool axes_compatible_with_rank( const Value& axes, const size_t r...
function contains_axis (line 138) | inline bool contains_axis( const Value& axes, const size_t axis )
function sign (line 151) | int sign( T val )
function ceil_div (line 156) | inline int ceil_div( int x, int y )
function T (line 162) | T downsize( const T input, const T size, const T padding, const T stride...
function T (line 169) | T downsize( const T input, const T stride )
function T (line 175) | T upsize( const T input, const T size, const T padding, const T stride, ...
function T (line 182) | T upsize( const T input, const T stride )
function check (line 189) | void check( bool condition, const char* message, Args&&... args )
function check_axis_compatible_with_rank (line 197) | inline void check_axis_compatible_with_rank( const Value& axis, const si...
function check_axes_compatible_with_rank (line 203) | inline void check_axes_compatible_with_rank( const Value& axes, const si...
function check_range (line 209) | inline void check_range( const char* name, const Value& value, const Val...
function check_rank (line 224) | inline void check_rank( const char* name, const Value& value, const size...
function Shape (line 231) | inline Shape broadcast_shape( const Shape& xShape, const Shape& yShape, ...
function Shape (line 245) | inline Shape broadcast_shape( const Shape& xShape, const Shape& yShape )
function Shape (line 251) | inline Shape nullary_shape( const Value& shape )
function Shape (line 256) | inline Shape constant_shape( const Value& shape, const Value& value )
function Shape (line 265) | inline Shape unary_shape( const Shape& shape )
function Shape (line 270) | inline Shape binary_shape( const Shape& shape1, const Shape& shape2 )
function Shape (line 279) | inline Shape asymmetric_binary_shape( const Shape& shape1, const Shape& ...
function Shape (line 288) | inline Shape ternary_shape( const Shape& shape1, const Shape& shape2, co...
function Shape (line 293) | inline Shape reduce_shape( const Shape& input, const Value& axes )
function Shape (line 307) | inline Shape downsample_shape( const Shape& input, const Value& factor )
function Shape (line 323) | inline Shape upsample_shape( const Shape& input, const Value& factor )
function Shape (line 335) | inline Shape downsize_shape( const Shape& input, const Shape& kernel, co...
function Shape (line 346) | inline Shape upsize_shape( const Shape& input, const Shape& kernel, cons...
function Shape (line 357) | inline Shape conv_like_shape( const Shape& input, const Shape& filter, c...
function Shape (line 447) | inline Shape separable_conv_like_shape( const Shape& input, const Shape&...
function Shape (line 465) | inline Shape conv_shape( const Shape& input, const Shape& filter, const ...
function Shape (line 472) | inline Shape deconv_shape( const Shape& input, const Shape& filter, cons...
function Shape (line 479) | inline Shape separable_conv_shape( const Shape& input, const Shape& plan...
function Shape (line 486) | inline Shape separable_deconv_shape( const Shape& input, const Shape& pl...
function Shape (line 493) | inline Shape pool_like_shape( const Shape& input, const Value& size, con...
function Shape (line 545) | inline Shape sample_like_shape( const Shape& input, const Shape& index, ...
function Shape (line 553) | inline Shape pool_shape( const Shape& input, const Value& size, const Va...
function Shape (line 559) | inline Shape unpool_shape( const Shape& input, const Value& size, const ...
function Shape (line 565) | inline Shape sample_shape( const Shape& input, const Shape& index, const...
function Shape (line 571) | inline Shape desample_shape( const Shape& input, const Shape& index, con...
function Shape (line 577) | inline Shape normalize_shape_axes( const Shape& input, const Value& axes )
function Shape (line 584) | inline Shape normalize_shape_size( const Shape& input, const Value& size )
function Shape (line 592) | inline Shape batchnorm_shape( const Shape& input, const Shape& mean, con...
function Shape (line 606) | inline Shape roi_shape( const Shape& input, const Shape& rois, const Sha...
function Shape (line 626) | inline Shape roi_shape_resample( const Shape& input, const Shape& rois, ...
function Shape (line 634) | inline Shape reshape_shape( const Shape& input, const Value& shape, cons...
function Shape (line 684) | inline Shape transpose_shape( const Shape& input, const Value& axes )
function std (line 707) | inline std::vector<Shape> split_shape( const Shape& value, const Value& ...
function Shape (line 735) | inline Shape concat_shape( const std::vector<Shape>& valuesShape, const ...
function Shape (line 773) | inline Shape slice_shape( const Shape& input, const Value& axes, const V...
function Shape (line 838) | inline Shape stack_shape( const std::vector<Shape>& inputs, const Value&...
function std (line 862) | inline std::vector<Shape> unstack_shape( const Shape& input, const Value...
function Shape (line 881) | inline Shape squeeze_shape( const Shape& input, const Value& axes )
function Shape (line 902) | inline Shape unsqueeze_shape( const Shape& input, const Value& axes )
function Shape (line 915) | inline Shape tile_shape( const Shape& input, const Value& repeats )
function Shape (line 928) | inline Shape pad_shape( const Shape& input, const Value& padding )
function Shape (line 940) | inline Shape gather_shape( const Shape& input, const Shape& indices, con...
function Shape (line 954) | inline Shape matmul_shape( const Shape& A, const Shape& B, const Value& ...
function Shape (line 982) | inline Shape linear_shape( const Shape& input, const Shape& filter, cons...
function Shape (line 995) | inline Shape update_shape( const Shape& variable, const Shape& value )
function Shape (line 1001) | inline Shape softmax_shape( const Shape& inputShape, const Value& axes )
function std (line 1007) | inline std::vector<Shape> copy_n_shape( const Shape& shape, const Value&...
function Shape (line 1013) | inline Shape add_n_shape( const std::vector<Shape>& inputs )
function Shape (line 1025) | inline Shape quantize_shape( const Shape& input, const Shape& min, const...
function Shape (line 1037) | inline Shape linear_quantize_shape( const Shape& input, const Shape& min...
function Shape (line 1042) | inline Shape logarithmic_quantize_shape( const Shape& input, const Shape...
function Shape (line 1047) | inline Shape zero_point_linear_quantize_shape( const Shape& input, const...
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/typespec.h
function Typename (line 32) | enum class Typename { Integer, Scalar, Logical, String, Generic };
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/typeutils.h
function namespace (line 26) | namespace nnef
function Type (line 115) | inline const Type* commonType( const Type* type1, const Type* type2 )
function Type (line 128) | inline const Type* bindDataType( const Type* paramType, const PrimitiveT...
function deduceDataType (line 167) | inline void deduceDataType( const Type* paramType, const Type* argType, ...
function deduceDataType (line 230) | inline bool deduceDataType( const Prototype& proto, const Dictionary<con...
FILE: nnef-pyproject/nnef/cpp/include/nnef/common/value.h
function namespace (line 27) | namespace nnef
function Value (line 97) | static Value integer( const integer_t& value )
function Value (line 102) | static Value scalar( const scalar_t& value )
function Value (line 107) | static Value logical( const logical_t& value )
function Value (line 112) | static Value string( const string_t& value )
function Value (line 117) | static Value identifier( const std::string& value )
function Value (line 122) | static Value array( const items_t& value )
function Value (line 127) | static Value tuple( const items_t& value )
function Value (line 132) | static Value array( items_t&& items )
function Value (line 137) | static Value tuple( items_t&& items )
function Value (line 142) | static Value make( const integer_t& value )
function Value (line 147) | static Value make( const scalar_t& value )
function Value (line 152) | static Value make( const logical_t& value )
function Value (line 157) | static Value make( const string_t& value )
function Value (line 162) | static Value make( const identifier_t& value )
function integer_t (line 225) | const integer_t& integer() const
function Value (line 285) | const Value& operator[]( const size_t i ) const
function operator (line 291) | bool operator==( const Value& other ) const
function operator (line 296) | bool operator!=( const Value& other ) const
function logical_t (line 320) | const logical_t& get( logical_t ) const
function string_t (line 325) | const string_t& get( string_t ) const
function identifier_t (line 330) | const identifier_t& get( identifier_t ) const
function move (line 357) | void move( Value& other )
function construct (line 400) | void construct( const Value& other )
function destroy (line 443) | void destroy()
function equals (line 470) | bool equals( const Value& other ) const
function std (line 596) | inline std::vector<int> nestedArrayShape( const Value& value )
FILE: nnef-pyproject/nnef/cpp/include/nnef/comp/comp_parser.h
function namespace (line 37) | namespace nnef
function Type (line 1493) | static const Type* resultType( const Prototype& proto, const PrimitiveTy...
function Type (line 1508) | static const Type* unaryResultType( const Type* argType, int op )
function Type (line 1536) | static const Type* binaryResultType( const Type* lhsType, const Type* rh...
function Type (line 1605) | static const Type* builtinResultType( int op )
function Type (line 1642) | static const Type* typeOf( const Value& value )
function tokenPrecedence (line 1686) | static int tokenPrecedence( int token )
function Dictionary (line 1762) | static Dictionary<Shared<Expr>> makeUnaryOpArgs( const Shared<Expr>& rig...
function Dictionary (line 1771) | static Dictionary<Shared<Expr>> makeBinaryOpArgs( const Shared<Expr> lef...
FILE: nnef-pyproject/nnef/cpp/include/nnef/comp/evaluation.h
function namespace (line 31) | namespace nnef
function Value (line 774) | Value evaluateBinary( const Value& left, const Value& right )
function Typename (line 790) | static Typename dtypeOf( const Value& value, const Dictionary<Typename>&...
function insertCopy (line 810) | void insertCopy( const Value& lvalue, const Value& rvalue, Dictionary<Ty...
function assign (line 827) | void assign( const Expr& lhs, const Value& rvalue, Dictionary<Value>& id...
function unassign (line 899) | void unassign( const Expr& lhs, Dictionary<Value>& ids )
function declare (line 927) | static void declare( const Value& arg, const Type* type, Dictionary<Type...
function checkStructure (line 970) | static void checkStructure( const Value& value, const Type* type, const ...
function Position (line 1023) | Position chain( const Position& position, const Position& origin )
function Value (line 1049) | Value makeResultValue( const std::string& op, size_t idx )
function hasNone (line 1100) | bool hasNone( const Value& value )
function addReservedIdentifiers (line 1127) | void addReservedIdentifiers( const Expr& expr )
function isReservedId (line 1155) | bool isReservedId( const std::string& id )
function isReservedId (line 1160) | bool isReservedId( const std::string& id, const size_t size )
function idx (line 1172) | size_t idx )
function T (line 1182) | T operator()( const T& left, const T& right )
FILE: nnef-pyproject/nnef/cpp/include/nnef/comp/expression.h
function namespace (line 31) | namespace nnef
function class (line 426) | class UnaryExpr : public Expr
function virtual (line 450) | virtual const Type* type() const
function virtual (line 455) | virtual void print( std::ostream& os ) const
function class (line 479) | class BinaryExpr : public Expr
function virtual (line 508) | virtual const Type* type() const
function virtual (line 513) | virtual void print( std::ostream& os ) const
function class (line 545) | class BuiltinExpr : public Expr
function virtual (line 569) | virtual const Type* type() const
function virtual (line 574) | virtual void print( std::ostream& os ) const
function class (line 589) | class SelectExpr : public Expr
function virtual (line 618) | virtual const Type* type() const
function virtual (line 623) | virtual void print( std::ostream& os ) const
function class (line 641) | class InvocationExpr : public Expr
FILE: nnef-pyproject/nnef/cpp/include/nnef/comp/fragment.h
function namespace (line 25) | namespace nnef
function class (line 54) | class Fragment
function Assignment (line 78) | const Assignment& assignment( const size_t i ) const
FILE: nnef-pyproject/nnef/cpp/include/nnef/comp/stdlib_source.h
function namespace (line 21) | namespace nnef {
function fragment (line 322) | fragment gelu( x: tensor<scalar> ) -> ( y: tensor<scalar> )
function fragment (line 331) | fragment silu( x: tensor<scalar> ) -> ( y: tensor<scalar> )
function fragment (line 336) | fragment prelu( x: tensor<scalar>, alpha: tensor<scalar> ) -> ( y: tenso...
function fragment (line 341) | fragment leaky_relu( x: tensor<scalar>, alpha: scalar ) -> ( y: tensor<s...
function fragment (line 404) | fragment linear(
function fragment (line 463) | fragment local_mean_normalization( input: tensor<scalar>, size: integer[...
function fragment (line 493) | fragment batch_normalization( input: tensor<scalar>, mean: tensor<scalar...
function fragment (line 560) | fragment min_max_linear_quantize(
function fragment (line 576) | fragment zero_point_linear_quantize(
function fragment (line 592) | fragment linear_quantize(
function fragment (line 603) | fragment logarithmic_quantize(
function fragment (line 623) | fragment add_n( x: tensor<scalar>[] ) -> ( y: tensor<scalar> )
FILE: nnef-pyproject/nnef/cpp/include/nnef/flat/flat_parser.h
function namespace (line 31) | namespace nnef
function Dictionary (line 714) | static Dictionary<Prototype> buildPrototypes()
FILE: nnef-pyproject/nnef/cpp/include/nnef/flat/quant_parser.h
function namespace (line 29) | namespace nnef
FILE: nnef-pyproject/nnef/cpp/include/nnef/runtime/execution.h
function namespace (line 35) | namespace nnef { namespace rt
function _extract_items (line 200) | DISPATCH_BY_DTYPE(select)
function Shape (line 213) | inline Shape _make_padding( const size_t rank, const int input[], const ...
function _execute_transpose (line 347) | DISPATCH_BY_DTYPE(reshape)
function _execute_concat (line 369) | DISPATCH_BY_DTYPE(transpose)
function _execute_split (line 394) | DISPATCH_BY_DTYPE(concat)
function execute_pad (line 419) | DISPATCH_BY_DTYPE(split)
function _execute_slice (line 475) | DISPATCH_BY_DTYPE(tile)
function _execute_gather (line 518) | DISPATCH_BY_DTYPE(slice)
function _execute_cast (line 535) | DISPATCH_BY_DTYPE(gather)
function execute_matmul (line 567) | DISPATCH_BY_DTYPE(cast)
FILE: nnef-pyproject/nnef/cpp/include/nnef/runtime/ndrange.h
function namespace (line 21) | namespace nnef { namespace rt
function nd_loop (line 58) | void nd_loop( const S shape[], const Op& op )
function call (line 68) | static inline size_t call( const S shape[], const I index[] )
function nd_offset (line 93) | size_t nd_offset( const S shape[], const I index[] )
function call (line 102) | static inline size_t call( const S shape[] )
function call (line 111) | static inline size_t call( const S shape[] )
function call (line 120) | static inline size_t call( const S shape[] )
function nd_volume (line 127) | size_t nd_volume( const S shape[] )
function nd_volume (line 133) | size_t nd_volume( const size_t rank, const S shape[] )
function call (line 142) | static inline void call( const Op& op )
function call (line 152) | static inline void call( const Op& op )
function call (line 161) | static inline void call( const Op& op )
function for_n (line 167) | void for_n( const Op& op )
function call (line 176) | static inline bool call( const Op& op )
function call (line 185) | static inline bool call( const Op& op )
function call (line 194) | static inline bool call( const Op& op )
function all_n (line 201) | bool all_n( const Op& op )
function tensor_view (line 215) | tensor_view operator[]( const size_t idx ) const
FILE: nnef-pyproject/nnef/cpp/include/nnef/runtime/operations.h
function namespace (line 25) | namespace nnef { namespace rt
function _binary (line 45) | void _binary( const size_t n, const T* x, const size_t dx, const T* y, c...
FILE: nnef-pyproject/nnef/cpp/infer.cpp
function read_file (line 54) | std::string read_file( const char* fn )
function read_inputs_from_cin (line 65) | bool read_inputs_from_cin( nnef::Graph& graph, std::string& error )
function read_inputs_from_file (line 78) | bool read_inputs_from_file( nnef::Graph& graph, const std::vector<std::s...
function write_output_to_cout (line 92) | bool write_output_to_cout( const nnef::Graph& graph, std::string& error )
function write_output_to_file (line 105) | bool write_output_to_file( const nnef::Graph& graph, const std::vector<s...
function T (line 120) | T sqr( const T x )
function T (line 126) | T relative_difference( const size_t n, const T* ref, const T* dat )
function volume (line 153) | int volume( const std::vector<int>& v )
function main (line 159) | int main( int argc, const char * argv[] )
FILE: nnef-pyproject/nnef/cpp/sample.cpp
function main (line 22) | int main( int argc, const char * argv[] )
FILE: nnef-pyproject/nnef/cpp/src/cnnef.cpp
function nnef_graph_t (line 25) | nnef_graph_t nnef_graph_load( const char* path, char *perror )
function nnef_graph_t (line 42) | nnef_graph_t nnef_graph_copy( nnef_graph_t graph )
function nnef_graph_release (line 48) | void nnef_graph_release( nnef_graph_t graph )
function nnef_graph_infer_shapes (line 57) | int nnef_graph_infer_shapes( nnef_graph_t graph, char *perror )
function nnef_graph_allocate_buffers (line 74) | int nnef_graph_allocate_buffers( nnef_graph_t graph, char *perror )
function nnef_graph_execute (line 94) | int nnef_graph_execute( nnef_graph_t graph, char *perror )
function nnef_graph_input_names (line 114) | size_t nnef_graph_input_names( nnef_graph_t graph, const char** inputs )
function nnef_graph_output_names (line 128) | size_t nnef_graph_output_names( nnef_graph_t graph, const char** outputs )
function nnef_tensor_t (line 142) | nnef_tensor_t nnef_graph_find_tensor( nnef_graph_t graph, const char* te...
function nnef_tensor_t (line 162) | nnef_tensor_t nnef_tensor_create(void)
function nnef_tensor_release (line 167) | void nnef_tensor_release( nnef_tensor_t tensor )
function nnef_tensor_rank (line 188) | size_t nnef_tensor_rank( nnef_tensor_t tensor )
function nnef_tensor_read (line 206) | int nnef_tensor_read( const char* path, nnef_tensor_t tensor, char *perr...
function nnef_tensor_write (line 226) | int nnef_tensor_write( const char* path, nnef_tensor_t tensor, char *per...
FILE: nnef-pyproject/nnef/cpp/src/nnef.cpp
type nnef (line 28) | namespace nnef
type ParseCallback (line 31) | struct ParseCallback : public Parser::Callback
method ParseCallback (line 39) | ParseCallback( Graph& graph, std::istream& qis, const std::string& q...
method beginGraph (line 44) | virtual void beginGraph( const Prototype& proto, const Dictionary<Pr...
method endGraph (line 68) | virtual void endGraph( const Prototype& proto, const Dictionary<Type...
method operation (line 87) | virtual void operation( const Prototype& proto, const Dictionary<Val...
function format_error_position (line 117) | std::string format_error_position( const Error::Position& pos )
function parse (line 122) | bool parse( std::istream& graph_is, const std::string& graph_fn, std::...
function parse_file (line 147) | bool parse_file( const std::string& graph_fn, const std::string& quant...
function parse_string (line 171) | bool parse_string( const std::string& graph_str, const std::string& qu...
function item_bytes (line 183) | size_t item_bytes( const std::string& dtype )
function item_bits (line 188) | size_t item_bits( const std::string& dtype )
function read_tensor (line 193) | bool read_tensor( std::istream& is, Tensor& tensor, std::string& error...
function write_tensor (line 258) | bool write_tensor( std::ostream& os, const Tensor& tensor, std::string...
function read_tensor (line 316) | bool read_tensor( const std::string& filename, Tensor& tensor, std::st...
function write_tensor (line 327) | bool write_tensor( const std::string& filename, const Tensor& tensor, ...
function load_variables (line 338) | bool load_variables( const std::string& path, Graph& graph, std::strin...
function file_exists (line 382) | bool file_exists( const std::string& path )
function load_graph (line 388) | bool load_graph( const std::string& path, Graph& graph, std::string& e...
type impl (line 412) | namespace impl
type index_sequence (line 415) | struct index_sequence {}
type index_sequence_maker (line 418) | struct index_sequence_maker : public index_sequence_maker<N-1U, N-1U...
type front_count_of (line 428) | struct front_count_of
function Shape (line 440) | const Shape shape_of( const Graph& graph, const Value& value )
function Shape (line 445) | Shape& shape_ref( Graph& graph, const Value& value )
function ShapeFunc (line 452) | ShapeFunc make_shape_func( Shape(*func)(const Args&...), index_seque...
function ShapeFunc (line 465) | ShapeFunc make_shape_func( std::vector<Shape>(*func)(const Shape&,co...
function ShapeFunc (line 482) | ShapeFunc make_shape_func( Shape(*func)(const std::vector<Shape>&,co...
function ShapeFunc (line 505) | ShapeFunc make_shape_func( Shape(*func)(const Value&,const Args&...) )
function ShapeFunc (line 511) | ShapeFunc make_shape_func( Shape(*func)(const Shape&,const Args&...) )
function ShapeFunc (line 517) | ShapeFunc make_shape_func( Shape(*func)(const std::vector<Shape>&,cons...
function ShapeFunc (line 523) | ShapeFunc make_shape_func( std::vector<Shape>(*func)(const Shape&,cons...
function infer_shapes (line 664) | bool infer_shapes( Graph& graph, std::string& error, const std::map<st...
function allocate_buffers (line 716) | bool allocate_buffers( Graph& graph, std::string& error ) noexcept
function execute (line 727) | bool execute( Graph& graph, std::string& error ) noexcept
type index_sequence_maker<0U, Next ... > (line 421) | struct index_sequence_maker<0U, Next ... > { using type = index_sequence...
type front_count_of<T,T,Args...> (line 434) | struct front_count_of<T,T,Args...>
FILE: nnef-pyproject/nnef/nnef.cpp
type NNEF_Identifier (line 54) | struct NNEF_Identifier
function PyObject (line 94) | static PyObject* makePyTuple( Args&& ...args )
function PyObject (line 106) | static PyObject* makePyObject( PyObject* type, Args&& ...args )
function PyObject (line 114) | static PyObject* makeNamedTuple( const char* name, std::initializer_list...
function PyObject (line 129) | static PyObject* buildPyBoolean( bool value )
function PyObject (line 141) | static PyObject* buildPyNone()
function PyObject (line 146) | static PyObject* buildPyObjectFromValue( const nnef::Value& value )
function numpy_type_num (line 197) | static int numpy_type_num( const nnef::Typename& dtype )
function PyArray_Descr (line 212) | static PyArray_Descr* numpy_dtype( const nnef::Typename& dtype )
function buildErrorString (line 227) | static std::string buildErrorString( nnef::Error e )
type GraphCallback (line 242) | struct GraphCallback : public nnef::Parser::Callback
method GraphCallback (line 244) | GraphCallback( std::istream& qis, const char* qfn )
method beginDocument (line 263) | virtual void beginDocument( const std::string& filename, const nnef::P...
method handleExtension (line 269) | virtual bool handleExtension( const std::string& ext )
method beginGraph (line 277) | virtual void beginGraph( const nnef::Prototype& proto, const nnef::Dic...
method endGraph (line 307) | virtual void endGraph( const nnef::Prototype& proto, const nnef::Dicti...
method operation (line 345) | virtual void operation( const nnef::Prototype& proto, const nnef::Dict...
function PyObject (line 393) | static PyObject* parse( PyObject* self, PyObject* args, PyObject* kwargs...
function PyObject (line 491) | static PyObject* parseFile( PyObject* self, PyObject* args, PyObject* kw...
function PyObject (line 496) | static PyObject* parseString( PyObject* self, PyObject* args, PyObject* ...
function PyObject (line 501) | static PyObject* createSession( PyObject* self, PyObject* args, PyObject...
function PyObject (line 560) | static PyObject* cleanupSession( PyObject* self, PyObject* args, PyObjec...
function PyObject (line 576) | static PyObject* executeSession( PyObject* self, PyObject* args, PyObjec...
type PyModuleDef (line 661) | struct PyModuleDef
function PyMODINIT_FUNC (line 681) | PyMODINIT_FUNC INIT_FUNC_NAME(void)
FILE: nnef-pyproject/nnef/parser.py
function parse_file (line 18) | def parse_file(graph_fn, quant_fn=None, stdlib=None, lowered=None):
function parse_string (line 22) | def parse_string(graph_str, quant_str=None, stdlib=None, lowered=None):
FILE: nnef-pyproject/nnef/printer.py
function format_version (line 18) | def format_version(version):
function format_extensions (line 23) | def format_extensions(extensions):
function format_argument (line 32) | def format_argument(value):
function format_result (line 49) | def format_result(value):
function format_shapes (line 60) | def format_shapes(result, tensors):
function format_invocation (line 71) | def format_invocation(name, attribs, inputs, outputs=None, dtype=None):
function format_graph (line 93) | def format_graph(name, inputs, outputs, operations, tensors, annotate_sh...
FILE: nnef-pyproject/nnef/shapes.py
function _ceil_div (line 19) | def _ceil_div(x, y):
function _clamp (line 23) | def _clamp(x, a, b):
function _ensure_rank (line 27) | def _ensure_rank(array, rank, value=1):
function _volume (line 31) | def _volume(shape):
function _broadcast_compatible (line 38) | def _broadcast_compatible(x,y):
function _broadcastable (line 42) | def _broadcastable(x,y):
function _broadcast_shape (line 46) | def _broadcast_shape(x, y):
function _downsize_shape (line 53) | def _downsize_shape(input, kernel, padding, stride, dilation):
function _upsize_shape (line 59) | def _upsize_shape(input, kernel, padding, stride, dilation):
function nullary_shape (line 65) | def nullary_shape(shape, **kwargs):
function unary_shape (line 69) | def unary_shape(arg, **kwargs):
function binary_shape (line 73) | def binary_shape(left, right, **kwargs):
function asymmetric_binary_shape (line 77) | def asymmetric_binary_shape(left, right, **kwargs):
function ternary_shape (line 83) | def ternary_shape(cond, left, right, **kwargs):
function pool_shape (line 88) | def pool_shape(input, size, border=None, padding=[], stride=[], dilation...
function pool_with_index_shape (line 118) | def pool_with_index_shape(input, size, border=None, padding=[], stride=[...
function unpool_shape (line 123) | def unpool_shape(input, size, border=None, padding=[], stride=[], dilati...
function sample_shape (line 127) | def sample_shape(input, index, size, border=None, padding=[], stride=[],...
function desample_shape (line 132) | def desample_shape(input, index, size, border=None, padding=[], stride=[...
function conv_shape (line 136) | def conv_shape(input, filter, bias=[], border=None, padding=[], stride=[...
function separable_conv_shape (line 188) | def separable_conv_shape(input, plane_filter, point_filter, bias=[], bor...
function separable_deconv_shape (line 202) | def separable_deconv_shape(input, plane_filter, point_filter, bias=[], b...
function deconv_shape (line 208) | def deconv_shape(input, filter, bias=[], border=None, padding=[], stride...
function reduce_shape (line 212) | def reduce_shape(input, axes, **kwargs):
function normalize_shape (line 218) | def normalize_shape(input, **kwargs):
function moments_shape (line 231) | def moments_shape(input, axes):
function downsample_shape (line 236) | def downsample_shape(input, factor, **kwargs):
function upsample_shape (line 245) | def upsample_shape(input, factor, **kwargs):
function reshape_shape (line 252) | def reshape_shape(input, shape, axis_start=0, axis_count=-1):
function transpose_shape (line 285) | def transpose_shape(input, axes):
function squeeze_shape (line 291) | def squeeze_shape(input, axes):
function unsqueeze_shape (line 297) | def unsqueeze_shape(input, axes):
function concat_shape (line 307) | def concat_shape(values, axis):
function split_shape (line 324) | def split_shape(value, axis, ratios):
function stack_shape (line 336) | def stack_shape(values, axis):
function unstack_shape (line 348) | def unstack_shape(value, axis):
function slice_shape (line 355) | def slice_shape(input, axes, begin, end, stride=[]):
function tile_shape (line 387) | def tile_shape(input, repeats):
function pad_shape (line 394) | def pad_shape(input, padding, **kwargs):
function gather_shape (line 401) | def gather_shape(input, indices, axis=0):
function matmul_shape (line 408) | def matmul_shape(A, B, transposeA=False, transposeB=False):
function linear_shape (line 421) | def linear_shape(input, filter, bias=[]):
function softmax_shape (line 436) | def softmax_shape(input, axes=[1]):
function batchnorm_shape (line 443) | def batchnorm_shape(input, mean, variance, offset, scale, epsilon=0):
function roi_shape (line 458) | def roi_shape(input, rois, batch_index, output_size, **kwargs):
function quantize_shape (line 479) | def quantize_shape(input, *args, **kwargs):
function update_shape (line 491) | def update_shape(variable, value):
function copy_n_shape (line 496) | def copy_n_shape(value, times):
function add_n_shape (line 501) | def add_n_shape(values):
function _get_shape (line 510) | def _get_shape(graph, value):
function _set_shape (line 521) | def _set_shape(graph, value, shape):
function infer_shapes (line 530) | def infer_shapes(graph, external_shapes={}, custom_shapes={}):
function _infer_op_shapes (line 579) | def _infer_op_shapes(op_name, attribs, input_shapes, output_counts, cust...
FILE: nnef-pyproject/tests/test.py
class ParserTest (line 21) | class ParserTest(unittest.TestCase):
method test_empty_document (line 23) | def test_empty_document(self):
method test_empty_body (line 27) | def test_empty_body(self):
method test_minimal (line 31) | def test_minimal(self):
method test_empty_input_not_declared (line 41) | def test_empty_input_not_declared(self):
method test_input_not_external (line 51) | def test_input_not_external(self):
method test_external_not_input (line 62) | def test_external_not_input(self):
method test_empty_output_not_declared (line 74) | def test_empty_output_not_declared(self):
method test_variable_update (line 84) | def test_variable_update(self):
method test_non_variable_update (line 95) | def test_non_variable_update(self):
method test_custom_fragment (line 106) | def test_custom_fragment(self):
method test_reshape (line 123) | def test_reshape(self):
FILE: nnef_tools-pyproject/custom/composite_export_example.py
function lp_norm (line 13) | def lp_norm(x, p=2, axis=None, keepdims=False, name=None):
function sum_pool2d (line 18) | def sum_pool2d(input, ksize, strides, padding, data_format='NHWC', name=...
FILE: nnef_tools-pyproject/custom/custom_operators_example.py
function shuffle (line 6) | def shuffle(input, groups):
FILE: nnef_tools-pyproject/custom/custom_optimizers_example.py
function replace_shuffle (line 6) | def replace_shuffle(reshape1, transpose, reshape2):
FILE: nnef_tools-pyproject/custom/onnx_custom_export_example.py
function aim_affine_grid (line 6) | def aim_affine_grid(g, trans, shape, align_corners):
function aim_grid_sample (line 10) | def aim_grid_sample(g, input, grid, mode, padding, align_corners):
class AffineTransform (line 18) | class AffineTransform(torch.nn.Module):
method __init__ (line 20) | def __init__(self, width, height):
method forward (line 25) | def forward(self, input, theta):
class Model (line 32) | class Model(torch.nn.Module):
method __init__ (line 34) | def __init__(self, grid_size):
method forward (line 41) | def forward(self, x, t):
FILE: nnef_tools-pyproject/custom/onnx_custom_transforms_example.py
function affine_grid_shape (line 4) | def affine_grid_shape(theta, shape):
FILE: nnef_tools-pyproject/nnef_tools/conversion/converter.py
class Transform (line 28) | class Transform:
method __init__ (line 30) | def __init__(self, type, name=None, inputs=None, outputs=None, attribs...
method with_type (line 42) | def with_type(self, type):
class ConversionError (line 47) | class ConversionError(Exception):
method __init__ (line 49) | def __init__(self, message, details=None):
class Converter (line 54) | class Converter:
method find_public_methods (line 57) | def find_public_methods(obj):
method find_public_functions (line 62) | def find_public_functions(obj):
method decomposed_operations (line 67) | def decomposed_operations():
method defined_operations (line 71) | def defined_operations():
method defined_operation_dependencies (line 75) | def defined_operation_dependencies():
method defined_shapes (line 79) | def defined_shapes():
method unpack_transforms (line 83) | def unpack_transforms(transforms):
method merge_transforms (line 103) | def merge_transforms(default_transforms, custom_transforms):
method __init__ (line 111) | def __init__(self, transforms, functions=None, mirror_unsupported=Fals...
method __call__ (line 121) | def __call__(self, graph):
method tensor_mapping (line 200) | def tensor_mapping(self):
method _global_attribs (line 204) | def _global_attribs(self):
method _prepare (line 207) | def _prepare(self, graph):
method _check_conditions (line 210) | def _check_conditions(self, op, transform):
method _error_message (line 229) | def _error_message(self, op, transform):
method _convert (line 244) | def _convert(self, op, transform):
method _mirror (line 299) | def _mirror(self, op):
method _add_default_attribs (line 309) | def _add_default_attribs(self, attribs, defaults, inputs, outputs, op_...
method _evaluate (line 322) | def _evaluate(self, attribs, inputs, outputs, arg, using={}):
method _evaluate_tensor_list (line 332) | def _evaluate_tensor_list(self, attribs, inputs, outputs, arg, using):
method _filter_none (line 343) | def _filter_none(self, items):
method _check_value (line 346) | def _check_value(self, value, kind, key, op_type, op_name, tensor=False):
method _copy_tensor_ (line 356) | def _copy_tensor_(self, tensor):
method _read_constant (line 360) | def _read_constant(self, tensor, type):
method _make_constant (line 363) | def _make_constant(self, graph, dtype, value, inline):
method _const_operation (line 366) | def _const_operation(self, output, value):
method _transpose_operation (line 369) | def _transpose_operation(self, input, output, perm):
method _reshape_operation (line 372) | def _reshape_operation(self, input, output, shape):
method _squeeze_operation (line 375) | def _squeeze_operation(self, input, output, axes):
method _unsqueeze_operation (line 378) | def _unsqueeze_operation(self, input, output, axes):
method _scale_operation (line 381) | def _scale_operation(self, input, output, scalar):
method _permute (line 385) | def _permute(items, perm):
method _inverse_permute (line 392) | def _inverse_permute(items, perm):
method _working_shape (line 398) | def _working_shape(self, tensor):
method _pre_transpose (line 401) | def _pre_transpose(self, input, perm):
method _post_transpose (line 407) | def _post_transpose(self, output, perm):
method _pre_squeeze (line 413) | def _pre_squeeze(self, input, axes):
method _pre_unsqueeze (line 419) | def _pre_unsqueeze(self, input, axes):
method _post_squeeze (line 425) | def _post_squeeze(self, output, axes):
method _post_unsqueeze (line 431) | def _post_unsqueeze(self, output, axes):
method _reshape (line 437) | def _reshape(self, input, shape):
method _shape_of (line 442) | def _shape_of(self, value):
method squeeze_shape (line 451) | def squeeze_shape(self, shape, axes):
method unsqueeze_shape (line 454) | def unsqueeze_shape(self, shape, axes):
method transposing (line 459) | def transposing(self, tensor):
method nxc_to_ncx (line 462) | def nxc_to_ncx(self, items, cond=True):
method ncx_to_nxc (line 465) | def ncx_to_nxc(self, items, cond=True):
method xcn_to_ncx (line 468) | def xcn_to_ncx(self, items, cond=True):
method ncx_to_xcn (line 471) | def ncx_to_xcn(self, items, cond=True):
method cxn_to_ncx (line 474) | def cxn_to_ncx(self, items, cond=True):
method ncx_to_cxn (line 477) | def ncx_to_cxn(self, items, cond=True):
method nxc_to_ncx_perm (line 480) | def nxc_to_ncx_perm(self, rank):
method ncx_to_nxc_perm (line 483) | def ncx_to_nxc_perm(self, rank):
method xcn_to_ncx_perm (line 486) | def xcn_to_ncx_perm(self, rank):
method ncx_to_xcn_perm (line 489) | def ncx_to_xcn_perm(self, rank):
method cxn_to_ncx_perm (line 492) | def cxn_to_ncx_perm(self, rank):
method ncx_to_cxn_perm (line 495) | def ncx_to_cxn_perm(self, rank):
method axis_nxc_to_ncx (line 498) | def axis_nxc_to_ncx(self, value, rank):
method axis_ncx_to_nxc (line 506) | def axis_ncx_to_nxc(self, value, rank):
method ensure_positive (line 514) | def ensure_positive(self, axis, rank):
method as_const (line 520) | def as_const(self, tensor, type=None):
method is_const (line 523) | def is_const(self, tensor, type=None):
method is_zero (line 533) | def is_zero(self, tensor):
method as_tensor (line 536) | def as_tensor(self, arg, dtype, inline=None):
method new_tensor (line 539) | def new_tensor(self, shape, dtype):
method is_integer_upsample (line 542) | def is_integer_upsample(self, input_shape, output_shape):
method is_integer_downsample (line 545) | def is_integer_downsample(self, input_shape, output_shape):
method upsample_factor (line 548) | def upsample_factor(self, input_shape, output_shape):
method downsample_factor (line 551) | def downsample_factor(self, input_shape, output_shape):
method from_numpy (line 554) | def from_numpy(self, array, type=None):
method to_numpy (line 557) | def to_numpy(self, value, dtype=None):
method flexible_batch (line 560) | def flexible_batch(self, output_shape, batch):
method fixed_batch (line 563) | def fixed_batch(self, output_shape, batch):
class ConverterToNNEF (line 567) | class ConverterToNNEF(Converter):
method __init__ (line 584) | def __init__(self, transforms, functions=None, mirror_unsupported=Fals...
method _insert_externals_and_constants (line 587) | def _insert_externals_and_constants(self, graph):
method _ensure_valid_ids (line 598) | def _ensure_valid_ids(self, graph):
method _make_constant (line 606) | def _make_constant(self, graph, dtype, value, inline):
method _const_operation (line 619) | def _const_operation(self, output, value):
method _transpose_operation (line 623) | def _transpose_operation(self, input, output, perm):
method _reshape_operation (line 626) | def _reshape_operation(self, input, output, shape):
method _squeeze_operation (line 629) | def _squeeze_operation(self, input, output, axes):
method _unsqueeze_operation (line 632) | def _unsqueeze_operation(self, input, output, axes):
method _scale_operation (line 635) | def _scale_operation(self, input, output, scalar):
method _bias_operation (line 641) | def _bias_operation(self, input, output, bias):
method _transform_constant (line 647) | def _transform_constant(self, tensor, func):
method remove_unused_constants (line 654) | def remove_unused_constants(graph):
method inline_scalar_constants (line 662) | def inline_scalar_constants(graph):
method convert_constants_to_variables (line 673) | def convert_constants_to_variables(graph):
method ensure_valid_id (line 686) | def ensure_valid_id(name):
method nnef_dtype (line 689) | def nnef_dtype(self, dtype):
class ConverterFromNNEF (line 693) | class ConverterFromNNEF(Converter):
method decomposed_operations (line 696) | def decomposed_operations():
method __init__ (line 701) | def __init__(self, transforms, functions=None, mirror_unsupported=False):
method convert_variables_to_constants (line 705) | def convert_variables_to_constants(graph):
method fill_data_in_constants (line 713) | def fill_data_in_constants(graph):
method _is_constant (line 718) | def _is_constant(self, tensor):
method _read_constant (line 724) | def _read_constant(self, tensor, type):
FILE: nnef_tools-pyproject/nnef_tools/conversion/nnef_to_onnx.py
class Converter (line 23) | class Converter(_Converter):
method defined_shapes (line 26) | def defined_shapes():
method decomposed_operations (line 40) | def decomposed_operations():
method __init__ (line 43) | def __init__(self, custom_transforms=None, custom_functions=None, mirr...
method __call__ (line 47) | def __call__(self, graph):
method _fix_inline_constants (line 54) | def _fix_inline_constants(self, graph):
method _make_constant (line 61) | def _make_constant(self, graph, dtype, value, inline):
method _const_operation (line 64) | def _const_operation(self, output, value):
method _transform_constant (line 68) | def _transform_constant(self, tensor, func):
method _squeeze_operation (line 77) | def _squeeze_operation(self, input, output, axes):
method _unsqueeze_operation (line 80) | def _unsqueeze_operation(self, input, output, axes):
method _interleave (line 83) | def _interleave(self, items):
method squeeze_input (line 86) | def squeeze_input(self, tensor, axes):
method squeeze_output (line 89) | def squeeze_output(self, tensor, axes):
method unsqueeze_input (line 92) | def unsqueeze_input(self, tensor, axes):
method unsqueeze_output (line 95) | def unsqueeze_output(self, tensor, axes):
method squeeze_vector (line 98) | def squeeze_vector(self, tensor):
method convert_pads (line 105) | def convert_pads(self, padding, truncate=False):
method convert_auto_pad (line 108) | def convert_auto_pad(self, padding):
method convert_output_padding (line 111) | def convert_output_padding(self, input_shape, filter_shape, output_sha...
method is_const (line 116) | def is_const(self, tensor, value=None):
method broadcast (line 119) | def broadcast(self, tensor, rank):
FILE: nnef_tools-pyproject/nnef_tools/conversion/nnef_to_tf.py
class Converter (line 24) | class Converter(_Converter):
method defined_shapes (line 27) | def defined_shapes():
method decomposed_operations (line 33) | def decomposed_operations():
method __init__ (line 36) | def __init__(self, data_format='NXC', io_transpose=False, custom_trans...
method __call__ (line 43) | def __call__(self, graph):
method _global_attribs (line 51) | def _global_attribs(self):
method _prepare (line 54) | def _prepare(self, graph):
method _fix_inline_constants (line 57) | def _fix_inline_constants(self, graph):
method _remove_unused_constants (line 63) | def _remove_unused_constants(self, graph):
method _fix_output_transposes (line 70) | def _fix_output_transposes(self, graph):
method _const_operation (line 74) | def _const_operation(self, output, value):
method _transpose_operation (line 78) | def _transpose_operation(self, input, output, perm):
method _reshape_operation (line 82) | def _reshape_operation(self, input, output, shape):
method _squeeze_operation (line 86) | def _squeeze_operation(self, input, output, axes):
method _unsqueeze_operation (line 90) | def _unsqueeze_operation(self, input, output, axes):
method _scale_operation (line 98) | def _scale_operation(self, input, output, scalar):
method _bias_operation (line 105) | def _bias_operation(self, input, output, bias):
method _make_constant (line 114) | def _make_constant(self, graph, dtype, value, inline):
method _transform_constant (line 119) | def _transform_constant(self, tensor, func):
method _is_conv_filter (line 124) | def _is_conv_filter(self, tensor, groups):
method _ensure_constant_producer (line 130) | def _ensure_constant_producer(self, tensor):
method _is_nxc (line 135) | def _is_nxc(self, format):
method _is_xcn (line 138) | def _is_xcn(self, format):
method _is_cxn (line 141) | def _is_cxn(self, format):
method needs_io_transpose (line 144) | def needs_io_transpose(self, tensor):
method is_nxc (line 152) | def is_nxc(self):
method data_format (line 155) | def data_format(self, rank):
method convert_padding (line 159) | def convert_padding(self, value):
method convert_explicit_paddings (line 162) | def convert_explicit_paddings(self, value):
method convert_size (line 169) | def convert_size(self, value):
method transpose_input (line 175) | def transpose_input(self, tensor):
method transpose_output (line 183) | def transpose_output(self, tensor):
method transpose_filter (line 188) | def transpose_filter(self, tensor, format='XCN'):
method transpose_depthwise_filter (line 200) | def transpose_depthwise_filter(self, tensor, channels, format='XCN'):
method transpose_like (line 213) | def transpose_like(self, tensor, reference):
method transpose_list_like (line 218) | def transpose_list_like(self, items, ref):
method transpose_axis_like (line 221) | def transpose_axis_like(self, axis, ref, rank=None):
method undo_transpose (line 224) | def undo_transpose(self, tensor):
method squeeze_input (line 230) | def squeeze_input(self, tensor, axes):
method squeeze_output (line 233) | def squeeze_output(self, tensor, axes):
method unsqueeze_input (line 236) | def unsqueeze_input(self, tensor, axes):
method unsqueeze_output (line 239) | def unsqueeze_output(self, tensor, axes):
method squeeze_vector (line 242) | def squeeze_vector(self, tensor):
method scale_output (line 249) | def scale_output(self, output, scalar):
method bias_add (line 254) | def bias_add(self, output, bias):
method split_sizes (line 262) | def split_sizes(self, ratios, size):
method convert_binarg (line 266) | def convert_binarg(self, tensor, other):
method as_numpy (line 277) | def as_numpy(self, value, dtype=None):
method as_bits (line 280) | def as_bits(self, items):
method out_of_range (line 287) | def out_of_range(self, x, limit):
FILE: nnef_tools-pyproject/nnef_tools/conversion/nnef_to_tflite.py
function tflite_detection_postprocess_shape (line 25) | def tflite_detection_postprocess_shape(input, scores, anchors, **kwargs):
class Converter (line 29) | class Converter(_TFConverter):
method defined_shapes (line 32) | def defined_shapes():
method decomposed_operations (line 39) | def decomposed_operations():
method __init__ (line 42) | def __init__(self, io_transpose=False, custom_transforms=None, custom_...
method __call__ (line 48) | def __call__(self, graph):
method _global_attribs (line 54) | def _global_attribs(self):
method _prepare (line 57) | def _prepare(self, graph):
method _transpose_externals (line 62) | def _transpose_externals(self, graph):
method _generate_tensor_names (line 68) | def _generate_tensor_names(self, graph):
method _fix_quantized_dtypes (line 82) | def _fix_quantized_dtypes(self, graph):
method _fix_quantization_attribs (line 90) | def _fix_quantization_attribs(self, graph):
method _fix_custom_options (line 104) | def _fix_custom_options(self, graph):
method _make_constant (line 111) | def _make_constant(self, graph, dtype, value, inline):
method _ensure_constant_producer (line 114) | def _ensure_constant_producer(self, tensor):
method _transform_constant (line 117) | def _transform_constant(self, tensor, func):
method _squeeze_operation (line 122) | def _squeeze_operation(self, input, output, axes):
method _unsqueeze_operation (line 125) | def _unsqueeze_operation(self, input, output, axes):
method _transpose_operation (line 133) | def _transpose_operation(self, input, output, perm):
method _reshape_operation (line 137) | def _reshape_operation(self, input, output, shape):
method _bias_operation (line 141) | def _bias_operation(self, input, output, bias):
method _scale_operation (line 147) | def _scale_operation(self, input, output, scalar):
method _pad_operation (line 153) | def _pad_operation(self, input, output, paddings):
method is_same_padding (line 159) | def is_same_padding(self, input_size, output_size, stride):
method is_valid_padding (line 162) | def is_valid_padding(self, padding):
method pad_input (line 165) | def pad_input(self, input, paddings):
FILE: nnef_tools-pyproject/nnef_tools/conversion/onnx_to_nnef.py
class Converter (line 148) | class Converter(_Converter):
method defined_operations (line 151) | def defined_operations():
method defined_operation_dependencies (line 165) | def defined_operation_dependencies():
method defined_shapes (line 171) | def defined_shapes():
method __init__ (line 184) | def __init__(self, custom_transforms=None, custom_functions=None, mirr...
method __call__ (line 194) | def __call__(self, graph):
method _prepare (line 207) | def _prepare(self, graph):
method _is_constant (line 210) | def _is_constant(self, tensor):
method _read_constant (line 216) | def _read_constant(self, tensor, type=None):
method _needs_io_transpose (line 226) | def _needs_io_transpose(self, tensor):
method _transpose_inputs (line 234) | def _transpose_inputs(self, graph):
method _transpose_outputs (line 245) | def _transpose_outputs(self, graph):
method _transpose_input (line 256) | def _transpose_input(self, tensor):
method _transpose_output (line 262) | def _transpose_output(self, tensor):
method _interleave (line 266) | def _interleave(items):
method _uninterleave (line 270) | def _uninterleave(items):
method convert_padding (line 274) | def convert_padding(self, pads, auto_pad, output_padding, rank, ceil_s...
method convert_pads (line 294) | def convert_pads(self, pads):
method squeeze_input (line 297) | def squeeze_input(self, tensor, axes, keep_dims=False):
method squeeze_output (line 300) | def squeeze_output(self, tensor, axes, keep_dims=False):
method unsqueeze_input (line 303) | def unsqueeze_input(self, tensor, axes, keep_dims=False):
method unsqueeze_output (line 306) | def unsqueeze_output(self, tensor, axes, keep_dims=False):
method unsqueeze_vector (line 309) | def unsqueeze_vector(self, tensor):
method bias_add (line 317) | def bias_add(self, output, bias):
method lower_pads (line 325) | def lower_pads(self, input_size, filter_size, output_size, stride, dil...
method ceil_pads (line 334) | def ceil_pads(self, pads, stride):
method broadcast (line 337) | def broadcast(self, tensor, rank):
method ensure_list (line 340) | def ensure_list(self, arg):
method ensure_scalar (line 343) | def ensure_scalar(self, arg):
method limit_range (line 346) | def limit_range(self, x):
method is_unused (line 349) | def is_unused(self, tensor):
FILE: nnef_tools-pyproject/nnef_tools/conversion/tf_to_nnef.py
class Converter (line 33) | class Converter(_Converter):
method defined_operations (line 39) | def defined_operations():
method __init__ (line 44) | def __init__(self, io_transpose=False, custom_transforms=None, custom_...
method __call__ (line 51) | def __call__(self, graph):
method _global_attribs (line 61) | def _global_attribs(self):
method _fix_output_transposes (line 64) | def _fix_output_transposes(self, graph):
method _is_conv_filter (line 75) | def _is_conv_filter(self, tensor):
method _is_depthwise_conv_filter (line 80) | def _is_depthwise_conv_filter(self, tensor):
method _is_constant (line 85) | def _is_constant(self, tensor):
method _read_constant (line 91) | def _read_constant(self, tensor, type=None):
method needs_io_transpose (line 100) | def needs_io_transpose(self, tensor):
method is_nxc (line 108) | def is_nxc(self, format):
method is_cxn (line 111) | def is_cxn(self, format):
method is_xcn (line 114) | def is_xcn(self, format):
method transpose_input (line 117) | def transpose_input(self, tensor, format='NXC'):
method transpose_output (line 125) | def transpose_output(self, tensor, format='NXC'):
method transpose_filter (line 130) | def transpose_filter(self, tensor, format='XCN'):
method transpose_depthwise_filter (line 142) | def transpose_depthwise_filter(self, tensor, format='XCN'):
method transpose_like (line 155) | def transpose_like(self, tensor, ref):
method undo_transpose (line 160) | def undo_transpose(self, tensor):
method convert_size (line 166) | def convert_size(self, value, format):
method convert_padding (line 169) | def convert_padding(self, padding, rank, explicit_paddings=None, forma...
method transpose_list_like (line 182) | def transpose_list_like(self, items, ref):
method transpose_axis_like (line 185) | def transpose_axis_like(self, axis, ref, rank=None):
method squeeze_input (line 189) | def squeeze_input(self, tensor, axes, keep_dims=False):
method squeeze_output (line 192) | def squeeze_output(self, tensor, axes, keep_dims=False):
method unsqueeze_input (line 195) | def unsqueeze_input(self, tensor, axes, keep_dims=False):
method unsqueeze_output (line 198) | def unsqueeze_output(self, tensor, axes, keep_dims=False):
method unsqueeze_vector (line 201) | def unsqueeze_vector(self, tensor):
method convert_binarg (line 209) | def convert_binarg(self, tensor, other):
method ensure_list (line 219) | def ensure_list(self, value):
method is_bit_set (line 222) | def is_bit_set(self, mask, idx):
method bit_count (line 225) | def bit_count(self, mask):
method replace_item_with (line 232) | def replace_item_with(self, items, index, count, value):
method replace_bit_with (line 235) | def replace_bit_with(self, mask, index, count, value):
method beg_index (line 241) | def beg_index(self, stride):
method end_index (line 244) | def end_index(self, stride):
FILE: nnef_tools-pyproject/nnef_tools/conversion/tflite_to_nnef.py
class Converter (line 49) | class Converter(_TFConverter):
method defined_operations (line 62) | def defined_operations():
method __init__ (line 68) | def __init__(self, io_transpose=False, custom_transforms=None, custom_...
method __call__ (line 75) | def __call__(self, graph):
method _global_attribs (line 80) | def _global_attribs(self):
method _prepare (line 83) | def _prepare(self, graph):
method _is_constant (line 89) | def _is_constant(self, tensor):
method _read_constant (line 92) | def _read_constant(self, tensor, type=None):
method _transpose_externals (line 98) | def _transpose_externals(self, graph):
method _is_zero (line 107) | def _is_zero(value):
method _fix_quantized_dtypes (line 110) | def _fix_quantized_dtypes(self, graph):
method _fix_quantization_attribs (line 119) | def _fix_quantization_attribs(self, graph):
method _fix_custom_options (line 155) | def _fix_custom_options(self, graph):
method _is_conv_filter (line 162) | def _is_conv_filter(self, tensor):
method _is_conv_bias (line 167) | def _is_conv_bias(self, tensor):
method activation (line 172) | def activation(self, output, func):
method flat_list (line 183) | def flat_list(self, array):
method flatten (line 186) | def flatten(self, input):
method same_shape (line 192) | def same_shape(self, input, output):
FILE: nnef_tools-pyproject/nnef_tools/convert.py
function get_reader (line 24) | def get_reader(input_format, decomposed, fold_constants, custom_shapes):
function get_writer (line 47) | def get_writer(output_format, fragments, fragment_dependencies, generate...
function get_converter (line 69) | def get_converter(input_format, output_format, io_transpose, custom_tran...
function get_optimizer (line 115) | def get_optimizer(format, custom_optimizers=None, dequantize=False):
function get_custom_converters (line 132) | def get_custom_converters(module_names):
function get_custom_shapes (line 147) | def get_custom_shapes(module_names):
function get_custom_fragments (line 159) | def get_custom_fragments(module_names):
function get_custom_optimizers (line 171) | def get_custom_optimizers(module_names):
function needs_conversion (line 183) | def needs_conversion(input_format, output_format):
function check_nan_or_inf (line 194) | def check_nan_or_inf(graph, which):
function main (line 220) | def main(args):
FILE: nnef_tools-pyproject/nnef_tools/execute.py
function _is_lambda (line 59) | def _is_lambda(v):
function uniform (line 64) | def uniform(min=0, max=1):
function normal (line 68) | def normal(mean=0, std=1):
function needs_transpose (line 72) | def needs_transpose(io_transpose, name):
function transpose_channels_last_to_first (line 76) | def transpose_channels_last_to_first(x):
function transpose_channels_first_to_last (line 81) | def transpose_channels_first_to_last(x):
function read_input (line 86) | def read_input(file, name, shape, dtype, transpose):
function compute_statistics (line 101) | def compute_statistics(array):
class RandomInputSource (line 114) | class RandomInputSource:
method __init__ (line 116) | def __init__(self, distribution):
method __call__ (line 119) | def __call__(self, name, shape, dtype):
class StreamInputSource (line 123) | class StreamInputSource:
method __init__ (line 125) | def __init__(self, stream, io_transpose):
method __call__ (line 129) | def __call__(self, name, shape, dtype):
class FileInputSource (line 134) | class FileInputSource:
method __init__ (line 136) | def __init__(self, folder, io_transpose):
method __call__ (line 140) | def __call__(self, name, shape, dtype):
class Executor (line 149) | class Executor:
method input_info (line 151) | def input_info(self):
method output_info (line 154) | def output_info(self):
method tensor_info (line 157) | def tensor_info(self):
method __call__ (line 160) | def __call__(self, inputs, output_names=None, collect_statistics=False):
class TFExecutor (line 164) | class TFExecutor(Executor):
method __init__ (line 166) | def __init__(self, model_path):
method input_info (line 190) | def input_info(self):
method output_info (line 194) | def output_info(self):
method tensor_info (line 198) | def tensor_info(self):
method __call__ (line 203) | def __call__(self, inputs, output_names=None, collect_statistics=False):
class TFLiteExecutor (line 235) | class TFLiteExecutor(Executor):
method __init__ (line 237) | def __init__(self, model_path):
method input_info (line 246) | def input_info(self):
method output_info (line 250) | def output_info(self):
method tensor_info (line 254) | def tensor_info(self):
method __call__ (line 258) | def __call__(self, inputs, output_names=None, collect_statistics=False):
class ONNXExecutor (line 283) | class ONNXExecutor(Executor):
method __init__ (line 285) | def __init__(self, model_path, require_intermediates=False):
method input_info (line 314) | def input_info(self):
method output_info (line 317) | def output_info(self):
method tensor_info (line 320) | def tensor_info(self):
method __call__ (line 323) | def __call__(self, inputs, output_names=None, collect_statistics=False):
class NNEFExecutor (line 351) | class NNEFExecutor(Executor):
method __init__ (line 353) | def __init__(self, model_path, custom_operators, decomposed):
method input_info (line 357) | def input_info(self):
method output_info (line 361) | def output_info(self):
method tensor_info (line 365) | def tensor_info(self):
method __call__ (line 369) | def __call__(self, inputs, output_names=None, collect_statistics=False):
function get_executor (line 377) | def get_executor(format, model_path, require_intermediates, custom_opera...
function write_nnef_tensor (line 390) | def write_nnef_tensor(filename, value):
function write_statistics (line 399) | def write_statistics(filename, statistics):
function get_custom_operators (line 407) | def get_custom_operators(module_names):
function batched_info (line 419) | def batched_info(tensor_info, batch_size):
function accumulate_statistics (line 428) | def accumulate_statistics(global_stats, local_stats):
function main (line 436) | def main(args):
FILE: nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relax/nnef_frontend.py
function get_type (line 29) | def get_type(elem_type: str):
class NNEFConverter (line 48) | class NNEFConverter:
method __init__ (line 65) | def __init__(self, keep_params_in_input=False):
method from_nnef (line 75) | def from_nnef(self, graph: nnef.Graph) -> tvm.IRModule:
method _parse_inputs (line 119) | def _parse_inputs(self, graph):
method _construct_nodes (line 127) | def _construct_nodes(self, graph):
method _set_operator (line 146) | def _set_operator(self, node):
method _set_const (line 186) | def _set_const(self, node):
method _set_variable (line 198) | def _set_variable(self, tensor):
method _set_literal_inputs (line 209) | def _set_literal_inputs(self, node):
method _get_relay_op_call (line 222) | def _get_relay_op_call(self, name, inputs, attrs):
method _infer_type (line 235) | def _infer_type(self, val):
method _new_var (line 261) | def _new_var(self, name, shape, dtype="float32"):
function from_nnef (line 268) | def from_nnef(
FILE: nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relax/nnef_ops.py
function dimension_picker (line 33) | def dimension_picker(prefix, kernel_shape, suffix=""):
function _size_conv (line 56) | def _size_conv(size, rank):
function _stride_conv (line 87) | def _stride_conv(stride, rank):
function _padding_conv (line 121) | def _padding_conv(padding, rank, keepdims=False):
function _calculate_nnef_padding (line 193) | def _calculate_nnef_padding(active_shape, strides, kernel_shape, dilation):
function _calculate_nnef_padding_deconv (line 218) | def _calculate_nnef_padding_deconv(data_sh, strides, kernel_active_sh, d...
function __unexpected_attrs (line 227) | def __unexpected_attrs(op, kwargs):
function _get_converter_map (line 237) | def _get_converter_map():
function ndop (line 369) | def ndop(*args, **kwargs):
function copy_converter (line 377) | def copy_converter(bbuilder, data, **kwargs):
function neg_converter (line 385) | def neg_converter(bbuilder, data, **kwargs):
function rcp_converter (line 393) | def rcp_converter(bbuilder, data, **kwargs):
function exp_converter (line 406) | def exp_converter(bbuilder, data, **kwargs):
function log_converter (line 414) | def log_converter(bbuilder, data, **kwargs):
function sin_converter (line 422) | def sin_converter(bbuilder, data, **kwargs):
function cos_converter (line 430) | def cos_converter(bbuilder, data, **kwargs):
function tan_converter (line 438) | def tan_converter(bbuilder, data, **kwargs):
function sinh_converter (line 446) | def sinh_converter(bbuilder, data, **kwargs):
function cosh_converter (line 454) | def cosh_converter(bbuilder, data, **kwargs):
function tanh_converter (line 462) | def tanh_converter(bbuilder, data, **kwargs):
function asin_converter (line 470) | def asin_converter(bbuilder, data, **kwargs):
function acos_converter (line 478) | def acos_converter(bbuilder, data, **kwargs):
function atan_converter (line 486) | def atan_converter(bbuilder, data, **kwargs):
function asinh_converter (line 494) | def asinh_converter(bbuilder, data, **kwargs):
function acosh_converter (line 502) | def acosh_converter(bbuilder, data, **kwargs):
function atanh_converter (line 510) | def atanh_converter(bbuilder, data, **kwargs):
function abs_converter (line 518) | def abs_converter(bbuilder, data, **kwargs):
function sign_converter (line 526) | def sign_converter(bbuilder, data, **kwargs):
function not_converter (line 534) | def not_converter(bbuilder, data, **kwargs):
function floor_converter (line 542) | def floor_converter(bbuilder, data, **kwargs):
function ceil_converter (line 550) | def ceil_converter(bbuilder, data, **kwargs):
function round_converter (line 558) | def round_converter(bbuilder, data, **kwargs):
function add_converter (line 569) | def add_converter(bbuilder, lhs, rhs, **kwargs):
function sub_converter (line 577) | def sub_converter(bbuilder, lhs, rhs, **kwargs):
function mul_converter (line 585) | def mul_converter(bbuilder, lhs, rhs, **kwargs):
function div_converter (line 604) | def div_converter(bbuilder, lhs, rhs, **kwargs):
function pow_converter (line 612) | def pow_converter(bbuilder, lhs, rhs, **kwargs):
function lt_converter (line 620) | def lt_converter(bbuilder, lhs, rhs, **kwargs):
function gt_converter (line 628) | def gt_converter(bbuilder, lhs, rhs, **kwargs):
function le_converter (line 636) | def le_converter(bbuilder, lhs, rhs, **kwargs):
function ge_converter (line 644) | def ge_converter(bbuilder, lhs, rhs, **kwargs):
function eq_converter (line 652) | def eq_converter(bbuilder, lhs, rhs, **kwargs):
function ne_converter (line 660) | def ne_converter(bbuilder, lhs, rhs, **kwargs):
function and_converter (line 668) | def and_converter(bbuilder, lhs, rhs, **kwargs):
function or_converter (line 676) | def or_converter(bbuilder, lhs, rhs, **kwargs):
function select_converter (line 687) | def select_converter(bbuilder, condition, t_val, f_val, **kwargs):
function sqr_converter (line 698) | def sqr_converter(bbuilder, data, **kwargs):
function sqrt_converter (line 708) | def sqrt_converter(bbuilder, data, **kwargs):
function rsqr_converter (line 716) | def rsqr_converter(bbuilder, data, **kwargs):
function rsqrt_converter (line 729) | def rsqrt_converter(bbuilder, data, **kwargs):
function log2_converter (line 737) | def log2_converter(bbuilder, data, **kwargs):
function min_converter (line 746) | def min_converter(bbuilder, lhs, rhs, **kwargs):
function max_converter (line 754) | def max_converter(bbuilder, lhs, rhs, **kwargs):
function clamp_converter (line 762) | def clamp_converter(bbuilder, x, a, b, **kwargs):
function conv_converter (line 779) | def conv_converter(
function deconv_converter (line 850) | def deconv_converter(
function box_converter (line 928) | def box_converter(bbuilder, data, size, border, padding, stride, dilatio...
function debox_converter (line 992) | def debox_converter(
function nearest_downsample_converter (line 1030) | def nearest_downsample_converter(bbuilder, data, factor, **kwargs):
function area_downsample_converter (line 1049) | def area_downsample_converter(bbuilder, data, factor, **kwargs):
function nearest_upsample_converter (line 1068) | def nearest_upsample_converter(bbuilder, data, factor, **kwargs):
function multilinear_upsample_converter (line 1098) | def multilinear_upsample_converter(bbuilder, data, factor, method, borde...
function sum_reduce_converter (line 1209) | def sum_reduce_converter(bbuilder, data, axes, normalize, keepdims=True,...
function max_reduce_converter (line 1221) | def max_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function min_reduce_converter (line 1229) | def min_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function argmax_reduce_converter (line 1237) | def argmax_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function argmin_reduce_converter (line 1246) | def argmin_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function all_reduce_converter (line 1255) | def all_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function any_reduce_converter (line 1264) | def any_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function mean_reduce_converter (line 1273) | def mean_reduce_converter(bbuilder, data, axes, keepdims=True, **kwargs):
function reshape_converter (line 1284) | def reshape_converter(bbuilder, data, shape, axis_start, axis_count, **k...
function squeeze_converter (line 1299) | def squeeze_converter(bbuilder, data, axes, **kwargs):
function unsqueeze_converter (line 1307) | def unsqueeze_converter(bbuilder, data, axes, **kwargs):
function transpose_converter (line 1321) | def transpose_converter(bbuilder, data, axes, **kwargs):
function split_converter (line 1329) | def split_converter(bbuilder, data, axis, ratios, **kwargs):
function concat_converter (line 1348) | def concat_converter(bbuilder, *data, axis, **kwargs):
function stack_converter (line 1356) | def stack_converter(bbuilder, *data, axis, **kwargs):
function unstack_converter (line 1366) | def unstack_converter(bbuilder, data, axis, **kwargs):
function slice_converter (line 1382) | def slice_converter(bbuilder, data, axes, begin, end, stride, **kwargs):
function pad_converter (line 1393) | def pad_converter(bbuilder, data, padding, border, value, **kwargs):
function tile_converter (line 1420) | def tile_converter(bbuilder, data, repeats, **kwargs):
function matmul_converter (line 1432) | def matmul_converter(bbuilder, a, b, **kwargs):
function sigmoid_converter (line 1465) | def sigmoid_converter(bbuilder, data, **kwargs):
function relu_converter (line 1473) | def relu_converter(bbuilder, data, **kwargs):
function prelu_converter (line 1481) | def prelu_converter(bbuilder, data, alpha, **kwargs):
function leaky_relu_converter (line 1504) | def leaky_relu_converter(bbuilder, data, alpha, **kwargs):
function elu_converter (line 1512) | def elu_converter(bbuilder, data, alpha, **kwargs):
function selu_converter (line 1529) | def selu_converter(bbuilder, data, alpha, **kwargs):
function gelu_converter (line 1553) | def gelu_converter(bbuilder, data, **kwargs):
function silu_converter (line 1570) | def silu_converter(bbuilder, data, **kwargs):
function softmax_converter (line 1578) | def softmax_converter(bbuilder, data, axes, **kwargs):
function softplus_converter (line 1590) | def softplus_converter(bbuilder, data, **kwargs):
function linear_converter (line 1603) | def linear_converter(bbuilder, data, _filter, bias, **kwargs):
function separable_conv_converter (line 1635) | def separable_conv_converter(
function separable_deconv_converter (line 1674) | def separable_deconv_converter(
function max_pool_converter (line 1717) | def max_pool_converter(bbuilder, data, size, border, padding, stride, di...
function avg_pool_converter (line 1763) | def avg_pool_converter(bbuilder, data, size, border, padding, stride, di...
function rms_pool_converter (line 1804) | def rms_pool_converter(bbuilder, data, size, border, padding, stride, di...
function local_response_normalization_converter (line 1826) | def local_response_normalization_converter(bbuilder, data, size, alpha, ...
function local_mean_normalization_converter (line 1842) | def local_mean_normalization_converter(bbuilder, data, size, **kwargs):
function local_variance_normalization_converter (line 1853) | def local_variance_normalization_converter(bbuilder, data, size, bias, e...
function local_contrast_normalization_converter (line 1881) | def local_contrast_normalization_converter(bbuilder, data, size, bias, e...
function l1_normalization_converter (line 1891) | def l1_normalization_converter(bbuilder, data, axes, bias, epsilon, **kw...
function l2_normalization_converter (line 1906) | def l2_normalization_converter(bbuilder, data, axes, bias, epsilon, **kw...
function batch_normalization_converter (line 1929) | def batch_normalization_converter(bbuilder, data, mean, variance, offset...
FILE: nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relay/from_nnef.py
function get_type (line 31) | def get_type(elem_type: str):
function make_parameter_span (line 49) | def make_parameter_span(source_name_list, name_sep="."):
class NNEFConverter (line 54) | class NNEFConverter:
method __init__ (line 69) | def __init__(self, freeze_vars=False):
method from_nnef (line 78) | def from_nnef(self, graph: nnef.Graph) -> typing.Tuple[tvm.IRModule, d...
method _parse_inputs (line 112) | def _parse_inputs(self, graph):
method _construct_nodes (line 120) | def _construct_nodes(self, graph):
method _set_operator (line 139) | def _set_operator(self, node):
method _set_const (line 189) | def _set_const(self, node):
method _set_variable (line 201) | def _set_variable(self, tensor):
method _set_literal_inputs (line 213) | def _set_literal_inputs(self, node):
method _set_parameter_span (line 226) | def _set_parameter_span(self, node, node_source_name):
method _set_par_span_helper (line 234) | def _set_par_span_helper(self, node, node_source_name, name, field_name):
method _get_relay_op_call (line 247) | def _get_relay_op_call(self, name, inputs, attrs):
method _infer_type (line 259) | def _infer_type(self, val):
function from_nnef (line 286) | def from_nnef(
FILE: nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relay/nnef_ops.py
function dimension_picker (line 33) | def dimension_picker(prefix, kernel_shape, suffix=""):
function _size_conv (line 56) | def _size_conv(size, rank):
function _stride_conv (line 87) | def _stride_conv(stride, rank):
function _padding_conv (line 121) | def _padding_conv(padding, rank, keepdims=False):
function _calculate_nnef_padding (line 193) | def _calculate_nnef_padding(active_shape, strides, kernel_shape, dilation):
function _calculate_nnef_padding_deconv (line 218) | def _calculate_nnef_padding_deconv(data_sh, strides, kernel_active_sh, d...
function __unexpected_attrs (line 227) | def __unexpected_attrs(op, kwargs):
function _get_converter_map (line 237) | def _get_converter_map():
function ndop (line 367) | def ndop(*args, **kwargs):
function copy_converter (line 374) | def copy_converter(data, **kwargs):
function neg_converter (line 382) | def neg_converter(data, **kwargs):
function rcp_converter (line 390) | def rcp_converter(data, **kwargs):
function exp_converter (line 403) | def exp_converter(data, **kwargs):
function log_converter (line 411) | def log_converter(data, **kwargs):
function sin_converter (line 419) | def sin_converter(data, **kwargs):
function cos_converter (line 427) | def cos_converter(data, **kwargs):
function tan_converter (line 435) | def tan_converter(data, **kwargs):
function sinh_converter (line 443) | def sinh_converter(data, **kwargs):
function cosh_converter (line 451) | def cosh_converter(data, **kwargs):
function tanh_converter (line 459) | def tanh_converter(data, **kwargs):
function asin_converter (line 467) | def asin_converter(data, **kwargs):
function acos_converter (line 475) | def acos_converter(data, **kwargs):
function atan_converter (line 483) | def atan_converter(data, **kwargs):
function asinh_converter (line 491) | def asinh_converter(data, **kwargs):
function acosh_converter (line 499) | def acosh_converter(data, **kwargs):
function atanh_converter (line 507) | def atanh_converter(data, **kwargs):
function abs_converter (line 515) | def abs_converter(data, **kwargs):
function sign_converter (line 523) | def sign_converter(data, **kwargs):
function not_converter (line 531) | def not_converter(data, **kwargs):
function floor_converter (line 539) | def floor_converter(data, **kwargs):
function ceil_converter (line 547) | def ceil_converter(data, **kwargs):
function round_converter (line 555) | def round_converter(data, **kwargs):
function add_converter (line 566) | def add_converter(lhs, rhs, **kwargs):
function sub_converter (line 574) | def sub_converter(lhs, rhs, **kwargs):
function mul_converter (line 582) | def mul_converter(lhs, rhs, **kwargs):
function div_converter (line 590) | def div_converter(lhs, rhs, **kwargs):
function pow_converter (line 598) | def pow_converter(lhs, rhs, **kwargs):
function lt_converter (line 606) | def lt_converter(lhs, rhs, **kwargs):
function gt_converter (line 614) | def gt_converter(lhs, rhs, **kwargs):
function le_converter (line 622) | def le_converter(lhs, rhs, **kwargs):
function ge_converter (line 630) | def ge_converter(lhs, rhs, **kwargs):
function eq_converter (line 638) | def eq_converter(lhs, rhs, **kwargs):
function ne_converter (line 646) | def ne_converter(lhs, rhs, **kwargs):
function and_converter (line 654) | def and_converter(lhs, rhs, **kwargs):
function or_converter (line 662) | def or_converter(lhs, rhs, **kwargs):
function select_converter (line 673) | def select_converter(condition, t_val, f_val, **kwargs):
function sqr_converter (line 684) | def sqr_converter(data, **kwargs):
function sqrt_converter (line 697) | def sqrt_converter(data, **kwargs):
function rsqr_converter (line 705) | def rsqr_converter(data, **kwargs):
function rsqrt_converter (line 718) | def rsqrt_converter(data, **kwargs):
function log2_converter (line 726) | def log2_converter(data, **kwargs):
function min_converter (line 734) | def min_converter(lhs, rhs, **kwargs):
function max_converter (line 742) | def max_converter(lhs, rhs, **kwargs):
function clamp_converter (line 750) | def clamp_converter(x, a, b, **kwargs):
function conv_converter (line 765) | def conv_converter(data, kernel, bias, border, stride, padding, dilation...
function deconv_converter (line 816) | def deconv_converter(
function box_converter (line 880) | def box_converter(data, size, border, padding, stride, dilation, normali...
function debox_converter (line 905) | def debox_converter(
function nearest_downsample_converter (line 939) | def nearest_downsample_converter(data, factor, **kwargs):
function area_downsample_converter (line 957) | def area_downsample_converter(data, factor, **kwargs):
function nearest_upsample_converter (line 975) | def nearest_upsample_converter(data, factor, **kwargs):
function multilinear_upsample_converter (line 993) | def multilinear_upsample_converter(data, factor, method, border, **kwargs):
function sum_reduce_converter (line 1077) | def sum_reduce_converter(data, axes, normalize, keepdims=True, **kwargs):
function max_reduce_converter (line 1089) | def max_reduce_converter(data, axes, keepdims=True, **kwargs):
function min_reduce_converter (line 1097) | def min_reduce_converter(data, axes, keepdims=True, **kwargs):
function argmax_reduce_converter (line 1105) | def argmax_reduce_converter(data, axes, keepdims=True, **kwargs):
function argmin_reduce_converter (line 1113) | def argmin_reduce_converter(data, axes, keepdims=True, **kwargs):
function all_reduce_converter (line 1121) | def all_reduce_converter(data, axes, keepdims=True, **kwargs):
function any_reduce_converter (line 1129) | def any_reduce_converter(data, axes, keepdims=True, **kwargs):
function mean_reduce_converter (line 1137) | def mean_reduce_converter(data, axes, keepdims=True, **kwargs):
function reshape_converter (line 1148) | def reshape_converter(data, shape, axis_start, axis_count, **kwargs):
function squeeze_converter (line 1163) | def squeeze_converter(data, axes, **kwargs):
function unsqueeze_converter (line 1170) | def unsqueeze_converter(data, axes, **kwargs):
function transpose_converter (line 1184) | def transpose_converter(data, axes, **kwargs):
function split_converter (line 1192) | def split_converter(data, axis, ratios, **kwargs):
function concat_converter (line 1211) | def concat_converter(*data, axis, **kwargs):
function stack_converter (line 1219) | def stack_converter(*data, axis, **kwargs):
function unstack_converter (line 1227) | def unstack_converter(data, axis, **kwargs):
function slice_converter (line 1239) | def slice_converter(data, axes, begin, end, stride, **kwargs):
function pad_converter (line 1250) | def pad_converter(data, padding, border, value, **kwargs):
function tile_converter (line 1264) | def tile_converter(data, repeats, **kwargs):
function matmul_converter (line 1276) | def matmul_converter(a, b, **kwargs):
function sigmoid_converter (line 1328) | def sigmoid_converter(data, **kwargs):
function relu_converter (line 1336) | def relu_converter(data, **kwargs):
function prelu_converter (line 1344) | def prelu_converter(data, alpha, **kwargs):
function leaky_relu_converter (line 1357) | def leaky_relu_converter(data, alpha, **kwargs):
function elu_converter (line 1365) | def elu_converter(data, alpha, **kwargs):
function selu_converter (line 1379) | def selu_converter(data, alpha, **kwargs):
function gelu_converter (line 1399) | def gelu_converter(data, **kwargs):
function silu_converter (line 1418) | def silu_converter(data, **kwargs):
function softmax_converter (line 1426) | def softmax_converter(data, axes, **kwargs):
function softplus_converter (line 1438) | def softplus_converter(data, **kwargs):
function linear_converter (line 1449) | def linear_converter(data, _filter, bias, **kwargs):
function separable_conv_converter (line 1468) | def separable_conv_converter(
function separable_deconv_converter (line 1487) | def separable_deconv_converter(
function max_pool_converter (line 1518) | def max_pool_converter(data, size, border, padding, stride, dilation, **...
function avg_pool_converter (line 1555) | def avg_pool_converter(data, size, border, padding, stride, dilation, **...
function rms_pool_converter (line 1588) | def rms_pool_converter(data, size, border, padding, stride, dilation, **...
function local_response_normalization_converter (line 1608) | def local_response_normalization_converter(data, size, alpha, beta, bias):
function local_mean_normalization_converter (line 1620) | def local_mean_normalization_converter(data, size, **kwargs):
function local_variance_normalization_converter (line 1629) | def local_variance_normalization_converter(data, size, bias, epsilon, **...
function local_contrast_normalization_converter (line 1643) | def local_contrast_normalization_converter(data, size, bias, epsilon, **...
function l1_normalization_converter (line 1652) | def l1_normalization_converter(data, axes, bias, epsilon, **kwargs):
function l2_normalization_converter (line 1663) | def l2_normalization_converter(data, axes, bias, epsilon, **kwargs):
function batch_normalization_converter (line 1679) | def batch_normalization_converter(data, mean, variance, offset, scale, e...
FILE: nnef_tools-pyproject/nnef_tools/generate.py
function _is_lambda (line 22) | def _is_lambda(value):
function _ensure_lambda (line 27) | def _ensure_lambda(value):
function uniform (line 31) | def uniform(min=0.0, max=1.0):
function normal (line 35) | def normal(mean=0.0, std=1.0):
function bernoulli (line 39) | def bernoulli(prob=0.5):
function integers (line 43) | def integers(min=0, max=100):
function main (line 47) | def main(args):
FILE: nnef_tools-pyproject/nnef_tools/gmac.py
function _volume (line 20) | def _volume(shape):
function _count_macs (line 24) | def _count_macs(op, include_pooling, include_upsampling, include_normali...
function get_custom_shapes (line 75) | def get_custom_shapes(module_names):
function main (line 89) | def main(args):
FILE: nnef_tools-pyproject/nnef_tools/image_tensor.py
function transform_image (line 28) | def transform_image(img, color, range, mean, std, size, dtype, data_form...
function main (line 64) | def main(args):
FILE: nnef_tools-pyproject/nnef_tools/interpreter/__init__.py
class Statistics (line 18) | class Statistics:
method __init__ (line 20) | def __init__(self, num, min, max, sum, ssum):
method __add__ (line 27) | def __add__(self, other):
method mean (line 35) | def mean(self):
method variance (line 38) | def variance(self, unbiased=True):
method std (line 45) | def std(self, unbiased=True):
FILE: nnef_tools-pyproject/nnef_tools/interpreter/pytorch/__init__.py
class Interpreter (line 25) | class Interpreter:
method __init__ (line 27) | def __init__(self, model, device=None, decomposed=None, custom_operato...
method __call__ (line 43) | def __call__(self, inputs, output_names=None, collect_statistics=False):
method input_details (line 73) | def input_details(self):
method output_details (line 76) | def output_details(self):
method tensor_details (line 79) | def tensor_details(self):
method _compute_statistics (line 83) | def _compute_statistics(torch_tensor):
method _init_input_shapes (line 97) | def _init_input_shapes(graph):
FILE: nnef_tools-pyproject/nnef_tools/interpreter/pytorch/nnef_module.py
class NNEFModule (line 27) | class NNEFModule(torch.nn.Module):
method __init__ (line 33) | def __init__(self,
method forward (line 76) | def forward(self, *inputs):
method save_nnef (line 131) | def save_nnef(self, path):
method activation_callback (line 141) | def activation_callback(self):
method activation_callback (line 145) | def activation_callback(self, callback):
method _is_variable (line 149) | def _is_variable(tensor):
method _is_constant (line 153) | def _is_constant(tensor):
method _as_numpy (line 157) | def _as_numpy(value, shape, dtype):
method _escape_keyword (line 167) | def _escape_keyword(name):
method _name_inline_constants (line 171) | def _name_inline_constants(graph):
method _registered_name (line 180) | def _registered_name(name):
method normalize_dtype (line 184) | def normalize_dtype(data):
method _dequantize (line 189) | def _dequantize(data, quant, channel_axis):
method _dequantize_zero_point (line 205) | def _dequantize_zero_point(data, zero_point, scale):
method _dequantize_min_max (line 209) | def _dequantize_min_max(data, min, max, signed, symmetric, bits):
method _fake_quantize (line 215) | def _fake_quantize(self, tensor, quant, channel_axis):
method _ensure_rank (line 226) | def _ensure_rank(value, rank, offset=0):
FILE: nnef_tools-pyproject/nnef_tools/interpreter/pytorch/nnef_operators.py
function _clamp (line 48) | def _clamp(x, a, b):
function _expand_to_rank (line 52) | def _expand_to_rank(input, rank):
function _expand_binary (line 58) | def _expand_binary(input1, input2):
function _binary (line 64) | def _binary(f):
function _prod (line 72) | def _prod(items):
function _same_padding (line 76) | def _same_padding(input, filter, stride, dilation):
function _inverse_permutation (line 86) | def _inverse_permutation(perm):
function _apply_permutation (line 93) | def _apply_permutation(items, perm):
function _positive_pad (line 99) | def _positive_pad(input, padding, border='constant', value=0.0):
function nnef_pad (line 129) | def nnef_pad(input, padding, border='constant', value=0.0):
function nnef_add_n (line 159) | def nnef_add_n(values):
function nnef_conv (line 163) | def nnef_conv(input, # type: torch.Tensor
function nnef_deconv (line 200) | def nnef_deconv(input, # type: torch.Tensor
function _evaluate_max_pool_or_box_params (line 286) | def _evaluate_max_pool_or_box_params(input_shape, size, padding, stride,...
function _max_pool_impl (line 297) | def _max_pool_impl(input, # type: torch.Tensor
function _box_impl (line 322) | def _box_impl(input, # type: torch.Tensor
function _get_transform_for_box_or_max_pool (line 368) | def _get_transform_for_box_or_max_pool(input_shape, active):
function _box_or_max_pool (line 387) | def _box_or_max_pool(input, # type: torch.Tensor
function nnef_max_pool (line 458) | def nnef_max_pool(input, # type: torch.Tensor
function nnef_max_pool_with_index (line 470) | def nnef_max_pool_with_index(input, # type: torch.Tensor
function nnef_argmax_pool (line 501) | def nnef_argmax_pool(input, # type: torch.Tensor
function nnef_box (line 514) | def nnef_box(input, # type: torch.Tensor
function nnef_debox (line 527) | def nnef_debox(input, # type: torch.Tensor
function nnef_avg_pool (line 566) | def nnef_avg_pool(input, # type: torch.Tensor
function nnef_rms_pool (line 577) | def nnef_rms_pool(input, # type: torch.Tensor
function nnef_desample (line 593) | def nnef_desample(input, # type: torch.Tensor
function nnef_batch_normalization (line 648) | def nnef_batch_normalization(input, # type: torch.Tensor
function _upsample_weights_1d (line 674) | def _upsample_weights_1d(factor, symmetric):
function _upsample_weights_2d (line 683) | def _upsample_weights_2d(factor, symmetric):
function _upsample_weights_nd (line 689) | def _upsample_weights_nd(factor, symmetric):
function nnef_multilinear_upsample (line 694) | def nnef_multilinear_upsample(input, factor, method='symmetric', border=...
function nnef_nearest_upsample (line 730) | def nnef_nearest_upsample(input, factor):
function nnef_softmax (line 739) | def nnef_softmax(x, axes=None):
function nnef_local_response_normalization (line 754) | def nnef_local_response_normalization(input, size, alpha=1.0, beta=0.5, ...
function nnef_local_mean_normalization (line 761) | def nnef_local_mean_normalization(input, size):
function nnef_local_variance_normalization (line 767) | def nnef_local_variance_normalization(input, size, bias=0.0, epsilon=0.0):
function nnef_local_contrast_normalization (line 774) | def nnef_local_contrast_normalization(input, size, bias=0.0, epsilon=0.0):
function nnef_l1_normalization (line 780) | def nnef_l1_normalization(input, axes, bias=0.0, epsilon=0.0):
function nnef_l2_normalization (line 787) | def nnef_l2_normalization(input, axes, bias=0.0, epsilon=0.0):
function nnef_matmul (line 794) | def nnef_matmul(A, B, transposeA=False, transposeB=False):
function nnef_split (line 801) | def nnef_split(value, axis, ratios):
function nnef_slice (line 810) | def nnef_slice(input, axes, begin, end, stride=None):
function nnef_select (line 845) | def nnef_select(condition, true_value, false_value):
function _nnef_generic_reduce (line 853) | def _nnef_generic_reduce(input, axes, f):
function nnef_sum_reduce (line 862) | def nnef_sum_reduce(input, axes, normalize=False):
function nnef_max_reduce (line 867) | def nnef_max_reduce(input, axes):
function nnef_min_reduce (line 873) | def nnef_min_reduce(input, axes):
function nnef_mean_reduce (line 879) | def nnef_mean_reduce(input, axes):
function _nnef_argminmax_reduce (line 884) | def _nnef_argminmax_reduce(input, axes, argmin=False):
function nnef_argmax_reduce (line 905) | def nnef_argmax_reduce(input, axes):
function nnef_argmin_reduce (line 910) | def nnef_argmin_reduce(input, axes):
function nnef_clamp (line 915) | def nnef_clamp(x, a, b):
function nnef_nearest_downsample (line 924) | def nnef_nearest_downsample(input, factor):
function nnef_area_downsample (line 930) | def nnef_area_downsample(input, factor):
function nnef_moments (line 936) | def nnef_moments(input, axes):
function nnef_linear (line 943) | def nnef_linear(input, filter, bias):
function nnef_separable_conv (line 950) | def nnef_separable_conv(input, # type: torch.Tensor
function nnef_separable_deconv (line 971) | def nnef_separable_deconv(input, # type: torch.Tensor
function nnef_copy_n (line 996) | def nnef_copy_n(x, times):
function nnef_zero_point_linear_quantize (line 1001) | def nnef_zero_point_linear_quantize(x, zero_point, scale, bits, signed, ...
function nnef_min_max_linear_quantize (line 1011) | def nnef_min_max_linear_quantize(x, min, max, bits, signed, symmetric):
function nnef_logarithmic_quantize (line 1020) | def nnef_logarithmic_quantize(x, max, bits):
function nnef_reshape (line 1029) | def nnef_reshape(input, shape, axis_start=0, axis_count=-1):
function nnef_update (line 1038) | def nnef_update(variable, value):
function nnef_transpose (line 1043) | def nnef_transpose(input, axes):
function nnef_squeeze (line 1047) | def nnef_squeeze(input, axes):
function nnef_unsqueeze (line 1051) | def nnef_unsqueeze(input, axes):
function nnef_cast (line 1055) | def nnef_cast(input, dtype):
function nnef_gather (line 1059) | def nnef_gather(input, indices, axis):
FILE: nnef_tools-pyproject/nnef_tools/io/caffe2/reader.py
function TranslateArgmax (line 39) | def TranslateArgmax(layer, pretrained_blobs, is_test, **kwargs):
function TranslateRelu (line 68) | def TranslateRelu(layer, pretrained_blobs, is_test, **kwargs):
function _HookedTranslateLayer (line 78) | def _HookedTranslateLayer(layer, pretrained_blobs, is_test, **kwargs):
function _caffe_to_caffe2 (line 95) | def _caffe_to_caffe2(prototxt, caffemodel):
function _pre_translate (line 128) | def _pre_translate(layer, blobs):
function _post_translate (line 144) | def _post_translate(layer, blobs, ops, params):
function _fix_conv_pool_param (line 149) | def _fix_conv_pool_param(param):
function _fix_eltwise_param (line 167) | def _fix_eltwise_param(param):
function _fix_batch_norm_param (line 173) | def _fix_batch_norm_param(param, blobs):
function _caffe2_net_to_onnx_model (line 179) | def _caffe2_net_to_onnx_model(predict_net, init_net, value_info):
function _remove_unrecognized_attributes (line 192) | def _remove_unrecognized_attributes(net_def):
function load_caffe_model (line 200) | def load_caffe_model(path):
function load_caffe_model_as_onnx (line 214) | def load_caffe_model_as_onnx(path):
function load_caffe2_model (line 221) | def load_caffe2_model(folder):
function load_caffe2_model_as_onnx (line 236) | def load_caffe2_model_as_onnx(folder):
class Reader (line 242) | class Reader:
method __init__ (line 244) | def __init__(self, legacy=False):
method __call__ (line 247) | def __call__(self, path):
FILE: nnef_tools-pyproject/nnef_tools/io/caffe2/writer.py
function save_caffe2_model (line 23) | def save_caffe2_model(folder, init_net, predict_net, value_info):
function get_value_info (line 34) | def get_value_info(onnx_model):
class Writer (line 46) | class Writer:
method __init__ (line 48) | def __init__(self):
method __call__ (line 51) | def __call__(self, graph, folder):
FILE: nnef_tools-pyproject/nnef_tools/io/nnef/helpers.py
function tgz_compress (line 19) | def tgz_compress(dir_path, file_path, compression_level=0):
function tgz_extract (line 29) | def tgz_extract(file_path, dir_path):
FILE: nnef_tools-pyproject/nnef_tools/io/nnef/reader.py
function _recursive_itemize (line 38) | def _recursive_itemize(arg):
function _make_constant_tensor (line 49) | def _make_constant_tensor(graph, value):
function _make_tensor (line 54) | def _make_tensor(graph, nnef_tensor):
function _build_graph (line 60) | def _build_graph(nnef_graph):
function _substitute_empty_array (line 94) | def _substitute_empty_array(op, key, attribs, inputs):
class Reader (line 107) | class Reader(object):
method __init__ (line 109) | def __init__(self, stdlib=None, decomposed=None, custom_shapes=None, i...
method __call__ (line 116) | def __call__(self, path, input_shapes=None):
FILE: nnef_tools-pyproject/nnef_tools/io/nnef/writer.py
function _nnef_dtype (line 53) | def _nnef_dtype(dtype):
function _print (line 57) | def _print(graph, file, extensions, fragments, version_custom_ops, annot...
function _write_tensor (line 115) | def _write_tensor(array, filename, quantized):
function _write_quantization (line 124) | def _write_quantization(graph, file):
function _printable_value (line 135) | def _printable_value(v):
function _next_version (line 144) | def _next_version(name, versions):
function _generate_custom_fragments (line 150) | def _generate_custom_fragments(graph, fragments, version):
function _generate_fragment (line 156) | def _generate_fragment(op, versions):
function _fragment_signature (line 166) | def _fragment_signature(name, dtype, attribs, inputs, outputs):
function _make_attrib_type (line 181) | def _make_attrib_type(value):
function _make_tensor_type (line 198) | def _make_tensor_type(value):
function _types_str (line 212) | def _types_str(names, items, tensor):
class Writer (line 217) | class Writer(object):
method __init__ (line 219) | def __init__(self, compression=None, extensions=None, fragments=None, ...
method __call__ (line 229) | def __call__(self, graph, path):
method _used_operators (line 278) | def _used_operators(graph, dependencies):
FILE: nnef_tools-pyproject/nnef_tools/io/onnx/reader.py
function _get_shape (line 48) | def _get_shape(tensor_shape_proto):
function _get_dtype (line 53) | def _get_dtype(dtype_int):
function _get_field (line 57) | def _get_field(proto, name, default=None):
function _get_value_info (line 61) | def _get_value_info(value_info_proto):
function _get_tensor (line 68) | def _get_tensor(tensor_proto):
function _get_tensor_data (line 110) | def _get_tensor_data(tensor_proto):
function _get_tensors (line 115) | def _get_tensors(graph_proto, graph, tensors_by_name):
function _get_node (line 148) | def _get_node(node_proto, graph, tensors_by_name):
function _get_attribute (line 161) | def _get_attribute(attribute_proto, graph, tensors_by_name):
function _get_block (line 194) | def _get_block(graph_proto, graph, tensors_by_name):
function _set_input_shapes (line 236) | def _set_input_shapes(graph_proto, input_shapes):
function _add_value_info_for_constants (line 247) | def _add_value_info_for_constants(model: onnx.ModelProto):
function onnx_model_to_graph (line 303) | def onnx_model_to_graph(onnx_model):
function read_tensor (line 314) | def read_tensor(filename):
class Reader (line 319) | class Reader(object):
method __init__ (line 321) | def __init__(self, simplify=False, optimize=None):
method __call__ (line 325) | def __call__(self, filename, input_shapes=None):
FILE: nnef_tools-pyproject/nnef_tools/io/onnx/writer.py
function build_model (line 41) | def build_model(graph, ir_version, opset_version):
function build_graph (line 54) | def build_graph(graph, graph_proto):
function build_value_info (line 81) | def build_value_info(tensor, value_info_proto):
function build_dtype (line 96) | def build_dtype(dtype):
function build_attribute_type (line 101) | def build_attribute_type(name):
function build_tensor_data (line 105) | def build_tensor_data(data, tensor_proto):
function build_tensor_proto (line 125) | def build_tensor_proto(tensor, tensor_proto):
function build_quantization (line 138) | def build_quantization(tensor, graph_proto):
function build_node (line 156) | def build_node(op, node_proto, idx):
function build_attribute (line 175) | def build_attribute(key, value, attribute_proto):
class Writer (line 226) | class Writer(object):
method __init__ (line 228) | def __init__(self, ir_version=6, opset_version=11):
method __call__ (line 232) | def __call__(self, graph, filename):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/graphdef/__init__.py
function save_default_graph (line 29) | def save_default_graph(filename, session, outputs, input_shapes=None, fo...
function load_default_graph (line 58) | def load_default_graph(filename):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/graphdef/composite.py
class _Composite (line 26) | class _Composite:
method __init__ (line 30) | def __init__(self, id, func, attribs, inputs, outputs):
method function (line 38) | def function(func):
method name (line 68) | def name(self):
function _is_tensor (line 75) | def _is_tensor(value):
function _node_name_from_tensor (line 79) | def _node_name_from_tensor(name):
function _input_name_from_tensor (line 88) | def _input_name_from_tensor(name):
function _build_node_def (line 92) | def _build_node_def(composite):
function _remap_tensors (line 111) | def _remap_tensors(tensors, graph):
function _tensor_producers_and_consumers (line 115) | def _tensor_producers_and_consumers(graph):
function _find_subgraph (line 126) | def _find_subgraph(composite, producers_and_consumers):
function replace_composites_with_py_functions (line 144) | def replace_composites_with_py_functions(graph_def):
function reset_composites (line 178) | def reset_composites():
FILE: nnef_tools-pyproject/nnef_tools/io/tf/graphdef/reader.py
function _get_shape (line 49) | def _get_shape(shape_proto):
function _get_dtype (line 54) | def _get_dtype(dtype_enum):
function _get_nonempty_items (line 60) | def _get_nonempty_items(message, fields):
function _get_tensor (line 69) | def _get_tensor(tensor_proto):
function _get_func (line 96) | def _get_func(name_attrlist_proto):
function _get_attribute (line 100) | def _get_attribute(field, value):
function _get_attributes (line 120) | def _get_attributes(attr_map_proto):
function _get_output_name (line 133) | def _get_output_name(node_name, idx):
function _has_output_shapes (line 137) | def _has_output_shapes(graph_def):
function _add_output_shapes (line 142) | def _add_output_shapes(graph_def):
function _get_dtypes (line 154) | def _get_dtypes(graph_def):
function _get_output_shapes (line 173) | def _get_output_shapes(attr_map_proto):
function build_graph (line 183) | def build_graph(graph_def):
function _unpack_custom_ops (line 218) | def _unpack_custom_ops(graph):
function read_graphdef (line 227) | def read_graphdef(filename, input_shapes, fold_constants):
class Reader (line 249) | class Reader(object):
method __init__ (line 251) | def __init__(self, fold_constants=False):
method __call__ (line 254) | def __call__(self, filename, input_shapes=None):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/graphdef/utils.py
function import_graph_def (line 26) | def import_graph_def(graph_def):
function export_graph_def (line 33) | def export_graph_def(graph):
function reinfer_shapes (line 37) | def reinfer_shapes(graph_def):
function _try_eval (line 41) | def _try_eval(tensor, session):
function _build_node (line 52) | def _build_node(type, name, attribs, inputs):
function _make_const_node (line 63) | def _make_const_node(value, name):
function _make_identity_node (line 67) | def _make_identity_node(input, name, dtype, shape):
function _freeze_shape_tensors (line 71) | def _freeze_shape_tensors(graph_def):
function _remove_const_control_dependencies (line 95) | def _remove_const_control_dependencies(graph_def):
function _remove_zero_index (line 106) | def _remove_zero_index(name):
function _remove_const_identities (line 110) | def _remove_const_identities(graph_def):
function _eval_candidates (line 131) | def _eval_candidates(graph):
function _fold_constant_tensors (line 151) | def _fold_constant_tensors(graph_def):
function _find_reachables_forward (line 189) | def _find_reachables_forward(graph, reachables):
function _find_reachables_backward (line 200) | def _find_reachables_backward(graph, reachables):
function _retain_nodes (line 213) | def _retain_nodes(graph_def, node_names):
function _retain_reachables_from_placeholders (line 228) | def _retain_reachables_from_placeholders(graph_def):
function _op_name_from_tensor (line 241) | def _op_name_from_tensor(name):
function fold_constant_tensors (line 250) | def fold_constant_tensors(graph_def):
function set_input_shapes (line 266) | def set_input_shapes(graph_def, input_shapes):
function retain_reachables_from_outputs (line 301) | def retain_reachables_from_outputs(graph_def, output_names):
function insert_rename_identities (line 309) | def insert_rename_identities(graph_def, tensor_rename):
function check_finite (line 319) | def check_finite(graph_def):
function check_variables (line 328) | def check_variables(session):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/graphdef/writer.py
function _build_shape (line 52) | def _build_shape(shape_proto, shape):
function _build_dtype (line 60) | def _build_dtype(dtype):
function _build_tensor (line 64) | def _build_tensor(tensor_proto, data):
function _build_attribute (line 75) | def _build_attribute(attr_proto, value):
function _build_output_shapes (line 125) | def _build_output_shapes(attr_proto, output_shapes):
function _tensor_name (line 130) | def _tensor_name(tensor):
function _custom_attribs (line 136) | def _custom_attribs(operation):
function _build_node (line 143) | def _build_node(node_def, operation):
function build_graphdef (line 164) | def build_graphdef(graph):
function write_graphdef (line 172) | def write_graphdef(graph, filename):
class Writer (line 179) | class Writer(object):
method __call__ (line 181) | def __call__(self, graph, filename):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AbsOptions.py
class AbsOptions (line 9) | class AbsOptions(object):
method GetRootAsAbsOptions (line 13) | def GetRootAsAbsOptions(cls, buf, offset):
method AbsOptionsBufferHasIdentifier (line 20) | def AbsOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function AbsOptionsStart (line 27) | def AbsOptionsStart(builder): builder.StartObject(0)
function AbsOptionsEnd (line 28) | def AbsOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ActivationFunctionType.py
class ActivationFunctionType (line 5) | class ActivationFunctionType(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AddNOptions.py
class AddNOptions (line 9) | class AddNOptions(object):
method GetRootAsAddNOptions (line 13) | def GetRootAsAddNOptions(cls, buf, offset):
method AddNOptionsBufferHasIdentifier (line 20) | def AddNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
function AddNOptionsStart (line 27) | def AddNOptionsStart(builder): builder.StartObject(0)
function AddNOptionsEnd (line 28) | def AddNOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AddOptions.py
class AddOptions (line 9) | class AddOptions(object):
method GetRootAsAddOptions (line 13) | def GetRootAsAddOptions(cls, buf, offset):
method AddOptionsBufferHasIdentifier (line 20) | def AddOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
function AddOptionsStart (line 34) | def AddOptionsStart(builder): builder.StartObject(1)
function AddOptionsAddFusedActivationFunction (line 35) | def AddOptionsAddFusedActivationFunction(builder, fusedActivationFunctio...
function AddOptionsEnd (line 36) | def AddOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ArgMaxOptions.py
class ArgMaxOptions (line 9) | class ArgMaxOptions(object):
method GetRootAsArgMaxOptions (line 13) | def GetRootAsArgMaxOptions(cls, buf, offset):
method ArgMaxOptionsBufferHasIdentifier (line 20) | def ArgMaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method OutputType (line 28) | def OutputType(self):
function ArgMaxOptionsStart (line 34) | def ArgMaxOptionsStart(builder): builder.StartObject(1)
function ArgMaxOptionsAddOutputType (line 35) | def ArgMaxOptionsAddOutputType(builder, outputType): builder.PrependInt8...
function ArgMaxOptionsEnd (line 36) | def ArgMaxOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ArgMinOptions.py
class ArgMinOptions (line 9) | class ArgMinOptions(object):
method GetRootAsArgMinOptions (line 13) | def GetRootAsArgMinOptions(cls, buf, offset):
method ArgMinOptionsBufferHasIdentifier (line 20) | def ArgMinOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method OutputType (line 28) | def OutputType(self):
function ArgMinOptionsStart (line 34) | def ArgMinOptionsStart(builder): builder.StartObject(1)
function ArgMinOptionsAddOutputType (line 35) | def ArgMinOptionsAddOutputType(builder, outputType): builder.PrependInt8...
function ArgMinOptionsEnd (line 36) | def ArgMinOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BatchMatMulOptions.py
class BatchMatMulOptions (line 9) | class BatchMatMulOptions(object):
method GetRootAsBatchMatMulOptions (line 13) | def GetRootAsBatchMatMulOptions(cls, buf, offset):
method BatchMatMulOptionsBufferHasIdentifier (line 20) | def BatchMatMulOptionsBufferHasIdentifier(cls, buf, offset, size_prefi...
method Init (line 24) | def Init(self, buf, pos):
method AdjX (line 28) | def AdjX(self):
method AdjY (line 35) | def AdjY(self):
function BatchMatMulOptionsStart (line 41) | def BatchMatMulOptionsStart(builder): builder.StartObject(2)
function BatchMatMulOptionsAddAdjX (line 42) | def BatchMatMulOptionsAddAdjX(builder, adjX): builder.PrependBoolSlot(0,...
function BatchMatMulOptionsAddAdjY (line 43) | def BatchMatMulOptionsAddAdjY(builder, adjY): builder.PrependBoolSlot(1,...
function BatchMatMulOptionsEnd (line 44) | def BatchMatMulOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BatchToSpaceNDOptions.py
class BatchToSpaceNDOptions (line 9) | class BatchToSpaceNDOptions(object):
method GetRootAsBatchToSpaceNDOptions (line 13) | def GetRootAsBatchToSpaceNDOptions(cls, buf, offset):
method BatchToSpaceNDOptionsBufferHasIdentifier (line 20) | def BatchToSpaceNDOptionsBufferHasIdentifier(cls, buf, offset, size_pr...
method Init (line 24) | def Init(self, buf, pos):
function BatchToSpaceNDOptionsStart (line 27) | def BatchToSpaceNDOptionsStart(builder): builder.StartObject(0)
function BatchToSpaceNDOptionsEnd (line 28) | def BatchToSpaceNDOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BidirectionalSequenceLSTMOptions.py
class BidirectionalSequenceLSTMOptions (line 9) | class BidirectionalSequenceLSTMOptions(object):
method GetRootAsBidirectionalSequenceLSTMOptions (line 13) | def GetRootAsBidirectionalSequenceLSTMOptions(cls, buf, offset):
method BidirectionalSequenceLSTMOptionsBufferHasIdentifier (line 20) | def BidirectionalSequenceLSTMOptionsBufferHasIdentifier(cls, buf, offs...
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
method CellClip (line 35) | def CellClip(self):
method ProjClip (line 42) | def ProjClip(self):
method MergeOutputs (line 49) | def MergeOutputs(self):
method TimeMajor (line 56) | def TimeMajor(self):
method AsymmetricQuantizeInputs (line 63) | def AsymmetricQuantizeInputs(self):
function BidirectionalSequenceLSTMOptionsStart (line 69) | def BidirectionalSequenceLSTMOptionsStart(builder): builder.StartObject(6)
function BidirectionalSequenceLSTMOptionsAddFusedActivationFunction (line 70) | def BidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, ...
function BidirectionalSequenceLSTMOptionsAddCellClip (line 71) | def BidirectionalSequenceLSTMOptionsAddCellClip(builder, cellClip): buil...
function BidirectionalSequenceLSTMOptionsAddProjClip (line 72) | def BidirectionalSequenceLSTMOptionsAddProjClip(builder, projClip): buil...
function BidirectionalSequenceLSTMOptionsAddMergeOutputs (line 73) | def BidirectionalSequenceLSTMOptionsAddMergeOutputs(builder, mergeOutput...
function BidirectionalSequenceLSTMOptionsAddTimeMajor (line 74) | def BidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor): bu...
function BidirectionalSequenceLSTMOptionsAddAsymmetricQuantizeInputs (line 75) | def BidirectionalSequenceLSTMOptionsAddAsymmetricQuantizeInputs(builder,...
function BidirectionalSequenceLSTMOptionsEnd (line 76) | def BidirectionalSequenceLSTMOptionsEnd(builder): return builder.EndObje...
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BidirectionalSequenceRNNOptions.py
class BidirectionalSequenceRNNOptions (line 9) | class BidirectionalSequenceRNNOptions(object):
method GetRootAsBidirectionalSequenceRNNOptions (line 13) | def GetRootAsBidirectionalSequenceRNNOptions(cls, buf, offset):
method BidirectionalSequenceRNNOptionsBufferHasIdentifier (line 20) | def BidirectionalSequenceRNNOptionsBufferHasIdentifier(cls, buf, offse...
method Init (line 24) | def Init(self, buf, pos):
method TimeMajor (line 28) | def TimeMajor(self):
method FusedActivationFunction (line 35) | def FusedActivationFunction(self):
method MergeOutputs (line 42) | def MergeOutputs(self):
method AsymmetricQuantizeInputs (line 49) | def AsymmetricQuantizeInputs(self):
function BidirectionalSequenceRNNOptionsStart (line 55) | def BidirectionalSequenceRNNOptionsStart(builder): builder.StartObject(4)
function BidirectionalSequenceRNNOptionsAddTimeMajor (line 56) | def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor): bui...
function BidirectionalSequenceRNNOptionsAddFusedActivationFunction (line 57) | def BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder, f...
function BidirectionalSequenceRNNOptionsAddMergeOutputs (line 58) | def BidirectionalSequenceRNNOptionsAddMergeOutputs(builder, mergeOutputs...
function BidirectionalSequenceRNNOptionsAddAsymmetricQuantizeInputs (line 59) | def BidirectionalSequenceRNNOptionsAddAsymmetricQuantizeInputs(builder, ...
function BidirectionalSequenceRNNOptionsEnd (line 60) | def BidirectionalSequenceRNNOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Buffer.py
class Buffer (line 9) | class Buffer(object):
method GetRootAsBuffer (line 13) | def GetRootAsBuffer(cls, buf, offset):
method BufferBufferHasIdentifier (line 20) | def BufferBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method Data (line 28) | def Data(self, j):
method DataAsNumpy (line 36) | def DataAsNumpy(self):
method DataLength (line 43) | def DataLength(self):
method DataIsNone (line 50) | def DataIsNone(self):
function BufferStart (line 54) | def BufferStart(builder): builder.StartObject(1)
function BufferAddData (line 55) | def BufferAddData(builder, data): builder.PrependUOffsetTRelativeSlot(0,...
function BufferStartDataVector (line 56) | def BufferStartDataVector(builder, numElems): return builder.StartVector...
function BufferEnd (line 57) | def BufferEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BuiltinOperator.py
class BuiltinOperator (line 5) | class BuiltinOperator(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BuiltinOptions.py
class BuiltinOptions (line 5) | class BuiltinOptions(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CallOptions.py
class CallOptions (line 9) | class CallOptions(object):
method GetRootAsCallOptions (line 13) | def GetRootAsCallOptions(cls, buf, offset):
method CallOptionsBufferHasIdentifier (line 20) | def CallOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method Subgraph (line 28) | def Subgraph(self):
function CallOptionsStart (line 34) | def CallOptionsStart(builder): builder.StartObject(1)
function CallOptionsAddSubgraph (line 35) | def CallOptionsAddSubgraph(builder, subgraph): builder.PrependUint32Slot...
function CallOptionsEnd (line 36) | def CallOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CastOptions.py
class CastOptions (line 9) | class CastOptions(object):
method GetRootAsCastOptions (line 13) | def GetRootAsCastOptions(cls, buf, offset):
method CastOptionsBufferHasIdentifier (line 20) | def CastOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method InDataType (line 28) | def InDataType(self):
method OutDataType (line 35) | def OutDataType(self):
function CastOptionsStart (line 41) | def CastOptionsStart(builder): builder.StartObject(2)
function CastOptionsAddInDataType (line 42) | def CastOptionsAddInDataType(builder, inDataType): builder.PrependInt8Sl...
function CastOptionsAddOutDataType (line 43) | def CastOptionsAddOutDataType(builder, outDataType): builder.PrependInt8...
function CastOptionsEnd (line 44) | def CastOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CombinerType.py
class CombinerType (line 5) | class CombinerType(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ConcatEmbeddingsOptions.py
class ConcatEmbeddingsOptions (line 9) | class ConcatEmbeddingsOptions(object):
method GetRootAsConcatEmbeddingsOptions (line 13) | def GetRootAsConcatEmbeddingsOptions(cls, buf, offset):
method ConcatEmbeddingsOptionsBufferHasIdentifier (line 20) | def ConcatEmbeddingsOptionsBufferHasIdentifier(cls, buf, offset, size_...
method Init (line 24) | def Init(self, buf, pos):
method NumChannels (line 28) | def NumChannels(self):
method NumColumnsPerChannel (line 35) | def NumColumnsPerChannel(self, j):
method NumColumnsPerChannelAsNumpy (line 43) | def NumColumnsPerChannelAsNumpy(self):
method NumColumnsPerChannelLength (line 50) | def NumColumnsPerChannelLength(self):
method NumColumnsPerChannelIsNone (line 57) | def NumColumnsPerChannelIsNone(self):
method EmbeddingDimPerChannel (line 62) | def EmbeddingDimPerChannel(self, j):
method EmbeddingDimPerChannelAsNumpy (line 70) | def EmbeddingDimPerChannelAsNumpy(self):
method EmbeddingDimPerChannelLength (line 77) | def EmbeddingDimPerChannelLength(self):
method EmbeddingDimPerChannelIsNone (line 84) | def EmbeddingDimPerChannelIsNone(self):
function ConcatEmbeddingsOptionsStart (line 88) | def ConcatEmbeddingsOptionsStart(builder): builder.StartObject(3)
function ConcatEmbeddingsOptionsAddNumChannels (line 89) | def ConcatEmbeddingsOptionsAddNumChannels(builder, numChannels): builder...
function ConcatEmbeddingsOptionsAddNumColumnsPerChannel (line 90) | def ConcatEmbeddingsOptionsAddNumColumnsPerChannel(builder, numColumnsPe...
function ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector (line 91) | def ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector(builder, numE...
function ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel (line 92) | def ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel(builder, embeddingD...
function ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector (line 93) | def ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector(builder, nu...
function ConcatEmbeddingsOptionsEnd (line 94) | def ConcatEmbeddingsOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ConcatenationOptions.py
class ConcatenationOptions (line 9) | class ConcatenationOptions(object):
method GetRootAsConcatenationOptions (line 13) | def GetRootAsConcatenationOptions(cls, buf, offset):
method ConcatenationOptionsBufferHasIdentifier (line 20) | def ConcatenationOptionsBufferHasIdentifier(cls, buf, offset, size_pre...
method Init (line 24) | def Init(self, buf, pos):
method Axis (line 28) | def Axis(self):
method FusedActivationFunction (line 35) | def FusedActivationFunction(self):
function ConcatenationOptionsStart (line 41) | def ConcatenationOptionsStart(builder): builder.StartObject(2)
function ConcatenationOptionsAddAxis (line 42) | def ConcatenationOptionsAddAxis(builder, axis): builder.PrependInt32Slot...
function ConcatenationOptionsAddFusedActivationFunction (line 43) | def ConcatenationOptionsAddFusedActivationFunction(builder, fusedActivat...
function ConcatenationOptionsEnd (line 44) | def ConcatenationOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Conv2DOptions.py
class Conv2DOptions (line 9) | class Conv2DOptions(object):
method GetRootAsConv2DOptions (line 13) | def GetRootAsConv2DOptions(cls, buf, offset):
method Conv2DOptionsBufferHasIdentifier (line 20) | def Conv2DOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method Padding (line 28) | def Padding(self):
method StrideW (line 35) | def StrideW(self):
method StrideH (line 42) | def StrideH(self):
method FusedActivationFunction (line 49) | def FusedActivationFunction(self):
method DilationWFactor (line 56) | def DilationWFactor(self):
method DilationHFactor (line 63) | def DilationHFactor(self):
function Conv2DOptionsStart (line 69) | def Conv2DOptionsStart(builder): builder.StartObject(6)
function Conv2DOptionsAddPadding (line 70) | def Conv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0...
function Conv2DOptionsAddStrideW (line 71) | def Conv2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(...
function Conv2DOptionsAddStrideH (line 72) | def Conv2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(...
function Conv2DOptionsAddFusedActivationFunction (line 73) | def Conv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunc...
function Conv2DOptionsAddDilationWFactor (line 74) | def Conv2DOptionsAddDilationWFactor(builder, dilationWFactor): builder.P...
function Conv2DOptionsAddDilationHFactor (line 75) | def Conv2DOptionsAddDilationHFactor(builder, dilationHFactor): builder.P...
function Conv2DOptionsEnd (line 76) | def Conv2DOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CosOptions.py
class CosOptions (line 9) | class CosOptions(object):
method GetRootAsCosOptions (line 13) | def GetRootAsCosOptions(cls, buf, offset):
method CosOptionsBufferHasIdentifier (line 20) | def CosOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function CosOptionsStart (line 27) | def CosOptionsStart(builder): builder.StartObject(0)
function CosOptionsEnd (line 28) | def CosOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CustomOptionsFormat.py
class CustomOptionsFormat (line 5) | class CustomOptionsFormat(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CustomQuantization.py
class CustomQuantization (line 9) | class CustomQuantization(object):
method GetRootAsCustomQuantization (line 13) | def GetRootAsCustomQuantization(cls, buf, offset):
method CustomQuantizationBufferHasIdentifier (line 20) | def CustomQuantizationBufferHasIdentifier(cls, buf, offset, size_prefi...
method Init (line 24) | def Init(self, buf, pos):
method Custom (line 28) | def Custom(self, j):
method CustomAsNumpy (line 36) | def CustomAsNumpy(self):
method CustomLength (line 43) | def CustomLength(self):
method CustomIsNone (line 50) | def CustomIsNone(self):
function CustomQuantizationStart (line 54) | def CustomQuantizationStart(builder): builder.StartObject(1)
function CustomQuantizationAddCustom (line 55) | def CustomQuantizationAddCustom(builder, custom): builder.PrependUOffset...
function CustomQuantizationStartCustomVector (line 56) | def CustomQuantizationStartCustomVector(builder, numElems): return build...
function CustomQuantizationEnd (line 57) | def CustomQuantizationEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DensifyOptions.py
class DensifyOptions (line 9) | class DensifyOptions(object):
method GetRootAsDensifyOptions (line 13) | def GetRootAsDensifyOptions(cls, buf, offset):
method DensifyOptionsBufferHasIdentifier (line 20) | def DensifyOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=...
method Init (line 24) | def Init(self, buf, pos):
function DensifyOptionsStart (line 27) | def DensifyOptionsStart(builder): builder.StartObject(0)
function DensifyOptionsEnd (line 28) | def DensifyOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DepthToSpaceOptions.py
class DepthToSpaceOptions (line 9) | class DepthToSpaceOptions(object):
method GetRootAsDepthToSpaceOptions (line 13) | def GetRootAsDepthToSpaceOptions(cls, buf, offset):
method DepthToSpaceOptionsBufferHasIdentifier (line 20) | def DepthToSpaceOptionsBufferHasIdentifier(cls, buf, offset, size_pref...
method Init (line 24) | def Init(self, buf, pos):
method BlockSize (line 28) | def BlockSize(self):
function DepthToSpaceOptionsStart (line 34) | def DepthToSpaceOptionsStart(builder): builder.StartObject(1)
function DepthToSpaceOptionsAddBlockSize (line 35) | def DepthToSpaceOptionsAddBlockSize(builder, blockSize): builder.Prepend...
function DepthToSpaceOptionsEnd (line 36) | def DepthToSpaceOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DepthwiseConv2DOptions.py
class DepthwiseConv2DOptions (line 9) | class DepthwiseConv2DOptions(object):
method GetRootAsDepthwiseConv2DOptions (line 13) | def GetRootAsDepthwiseConv2DOptions(cls, buf, offset):
method DepthwiseConv2DOptionsBufferHasIdentifier (line 20) | def DepthwiseConv2DOptionsBufferHasIdentifier(cls, buf, offset, size_p...
method Init (line 24) | def Init(self, buf, pos):
method Padding (line 28) | def Padding(self):
method StrideW (line 35) | def StrideW(self):
method StrideH (line 42) | def StrideH(self):
method DepthMultiplier (line 49) | def DepthMultiplier(self):
method FusedActivationFunction (line 56) | def FusedActivationFunction(self):
method DilationWFactor (line 63) | def DilationWFactor(self):
method DilationHFactor (line 70) | def DilationHFactor(self):
function DepthwiseConv2DOptionsStart (line 76) | def DepthwiseConv2DOptionsStart(builder): builder.StartObject(7)
function DepthwiseConv2DOptionsAddPadding (line 77) | def DepthwiseConv2DOptionsAddPadding(builder, padding): builder.PrependI...
function DepthwiseConv2DOptionsAddStrideW (line 78) | def DepthwiseConv2DOptionsAddStrideW(builder, strideW): builder.PrependI...
function DepthwiseConv2DOptionsAddStrideH (line 79) | def DepthwiseConv2DOptionsAddStrideH(builder, strideH): builder.PrependI...
function DepthwiseConv2DOptionsAddDepthMultiplier (line 80) | def DepthwiseConv2DOptionsAddDepthMultiplier(builder, depthMultiplier): ...
function DepthwiseConv2DOptionsAddFusedActivationFunction (line 81) | def DepthwiseConv2DOptionsAddFusedActivationFunction(builder, fusedActiv...
function DepthwiseConv2DOptionsAddDilationWFactor (line 82) | def DepthwiseConv2DOptionsAddDilationWFactor(builder, dilationWFactor): ...
function DepthwiseConv2DOptionsAddDilationHFactor (line 83) | def DepthwiseConv2DOptionsAddDilationHFactor(builder, dilationHFactor): ...
function DepthwiseConv2DOptionsEnd (line 84) | def DepthwiseConv2DOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DequantizeOptions.py
class DequantizeOptions (line 9) | class DequantizeOptions(object):
method GetRootAsDequantizeOptions (line 13) | def GetRootAsDequantizeOptions(cls, buf, offset):
method DequantizeOptionsBufferHasIdentifier (line 20) | def DequantizeOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function DequantizeOptionsStart (line 27) | def DequantizeOptionsStart(builder): builder.StartObject(0)
function DequantizeOptionsEnd (line 28) | def DequantizeOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DimensionMetadata.py
class DimensionMetadata (line 9) | class DimensionMetadata(object):
method GetRootAsDimensionMetadata (line 13) | def GetRootAsDimensionMetadata(cls, buf, offset):
method DimensionMetadataBufferHasIdentifier (line 20) | def DimensionMetadataBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
method Format (line 28) | def Format(self):
method DenseSize (line 35) | def DenseSize(self):
method ArraySegmentsType (line 42) | def ArraySegmentsType(self):
method ArraySegments (line 49) | def ArraySegments(self):
method ArrayIndicesType (line 59) | def ArrayIndicesType(self):
method ArrayIndices (line 66) | def ArrayIndices(self):
function DimensionMetadataStart (line 75) | def DimensionMetadataStart(builder): builder.StartObject(6)
function DimensionMetadataAddFormat (line 76) | def DimensionMetadataAddFormat(builder, format): builder.PrependInt8Slot...
function DimensionMetadataAddDenseSize (line 77) | def DimensionMetadataAddDenseSize(builder, denseSize): builder.PrependIn...
function DimensionMetadataAddArraySegmentsType (line 78) | def DimensionMetadataAddArraySegmentsType(builder, arraySegmentsType): b...
function DimensionMetadataAddArraySegments (line 79) | def DimensionMetadataAddArraySegments(builder, arraySegments): builder.P...
function DimensionMetadataAddArrayIndicesType (line 80) | def DimensionMetadataAddArrayIndicesType(builder, arrayIndicesType): bui...
function DimensionMetadataAddArrayIndices (line 81) | def DimensionMetadataAddArrayIndices(builder, arrayIndices): builder.Pre...
function DimensionMetadataEnd (line 82) | def DimensionMetadataEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DimensionType.py
class DimensionType (line 5) | class DimensionType(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DivOptions.py
class DivOptions (line 9) | class DivOptions(object):
method GetRootAsDivOptions (line 13) | def GetRootAsDivOptions(cls, buf, offset):
method DivOptionsBufferHasIdentifier (line 20) | def DivOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
function DivOptionsStart (line 34) | def DivOptionsStart(builder): builder.StartObject(1)
function DivOptionsAddFusedActivationFunction (line 35) | def DivOptionsAddFusedActivationFunction(builder, fusedActivationFunctio...
function DivOptionsEnd (line 36) | def DivOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/EmbeddingLookupSparseOptions.py
class EmbeddingLookupSparseOptions (line 9) | class EmbeddingLookupSparseOptions(object):
method GetRootAsEmbeddingLookupSparseOptions (line 13) | def GetRootAsEmbeddingLookupSparseOptions(cls, buf, offset):
method EmbeddingLookupSparseOptionsBufferHasIdentifier (line 20) | def EmbeddingLookupSparseOptionsBufferHasIdentifier(cls, buf, offset, ...
method Init (line 24) | def Init(self, buf, pos):
method Combiner (line 28) | def Combiner(self):
function EmbeddingLookupSparseOptionsStart (line 34) | def EmbeddingLookupSparseOptionsStart(builder): builder.StartObject(1)
function EmbeddingLookupSparseOptionsAddCombiner (line 35) | def EmbeddingLookupSparseOptionsAddCombiner(builder, combiner): builder....
function EmbeddingLookupSparseOptionsEnd (line 36) | def EmbeddingLookupSparseOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/EqualOptions.py
class EqualOptions (line 9) | class EqualOptions(object):
method GetRootAsEqualOptions (line 13) | def GetRootAsEqualOptions(cls, buf, offset):
method EqualOptionsBufferHasIdentifier (line 20) | def EqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
function EqualOptionsStart (line 27) | def EqualOptionsStart(builder): builder.StartObject(0)
function EqualOptionsEnd (line 28) | def EqualOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ExpOptions.py
class ExpOptions (line 9) | class ExpOptions(object):
method GetRootAsExpOptions (line 13) | def GetRootAsExpOptions(cls, buf, offset):
method ExpOptionsBufferHasIdentifier (line 20) | def ExpOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function ExpOptionsStart (line 27) | def ExpOptionsStart(builder): builder.StartObject(0)
function ExpOptionsEnd (line 28) | def ExpOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ExpandDimsOptions.py
class ExpandDimsOptions (line 9) | class ExpandDimsOptions(object):
method GetRootAsExpandDimsOptions (line 13) | def GetRootAsExpandDimsOptions(cls, buf, offset):
method ExpandDimsOptionsBufferHasIdentifier (line 20) | def ExpandDimsOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function ExpandDimsOptionsStart (line 27) | def ExpandDimsOptionsStart(builder): builder.StartObject(0)
function ExpandDimsOptionsEnd (line 28) | def ExpandDimsOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FakeQuantOptions.py
class FakeQuantOptions (line 9) | class FakeQuantOptions(object):
method GetRootAsFakeQuantOptions (line 13) | def GetRootAsFakeQuantOptions(cls, buf, offset):
method FakeQuantOptionsBufferHasIdentifier (line 20) | def FakeQuantOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
method Min (line 28) | def Min(self):
method Max (line 35) | def Max(self):
method NumBits (line 42) | def NumBits(self):
method NarrowRange (line 49) | def NarrowRange(self):
function FakeQuantOptionsStart (line 55) | def FakeQuantOptionsStart(builder): builder.StartObject(4)
function FakeQuantOptionsAddMin (line 56) | def FakeQuantOptionsAddMin(builder, min): builder.PrependFloat32Slot(0, ...
function FakeQuantOptionsAddMax (line 57) | def FakeQuantOptionsAddMax(builder, max): builder.PrependFloat32Slot(1, ...
function FakeQuantOptionsAddNumBits (line 58) | def FakeQuantOptionsAddNumBits(builder, numBits): builder.PrependInt32Sl...
function FakeQuantOptionsAddNarrowRange (line 59) | def FakeQuantOptionsAddNarrowRange(builder, narrowRange): builder.Prepen...
function FakeQuantOptionsEnd (line 60) | def FakeQuantOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FillOptions.py
class FillOptions (line 9) | class FillOptions(object):
method GetRootAsFillOptions (line 13) | def GetRootAsFillOptions(cls, buf, offset):
method FillOptionsBufferHasIdentifier (line 20) | def FillOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
function FillOptionsStart (line 27) | def FillOptionsStart(builder): builder.StartObject(0)
function FillOptionsEnd (line 28) | def FillOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FloorDivOptions.py
class FloorDivOptions (line 9) | class FloorDivOptions(object):
method GetRootAsFloorDivOptions (line 13) | def GetRootAsFloorDivOptions(cls, buf, offset):
method FloorDivOptionsBufferHasIdentifier (line 20) | def FloorDivOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function FloorDivOptionsStart (line 27) | def FloorDivOptionsStart(builder): builder.StartObject(0)
function FloorDivOptionsEnd (line 28) | def FloorDivOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FloorModOptions.py
class FloorModOptions (line 9) | class FloorModOptions(object):
method GetRootAsFloorModOptions (line 13) | def GetRootAsFloorModOptions(cls, buf, offset):
method FloorModOptionsBufferHasIdentifier (line 20) | def FloorModOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function FloorModOptionsStart (line 27) | def FloorModOptionsStart(builder): builder.StartObject(0)
function FloorModOptionsEnd (line 28) | def FloorModOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FullyConnectedOptions.py
class FullyConnectedOptions (line 9) | class FullyConnectedOptions(object):
method GetRootAsFullyConnectedOptions (line 13) | def GetRootAsFullyConnectedOptions(cls, buf, offset):
method FullyConnectedOptionsBufferHasIdentifier (line 20) | def FullyConnectedOptionsBufferHasIdentifier(cls, buf, offset, size_pr...
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
method WeightsFormat (line 35) | def WeightsFormat(self):
method KeepNumDims (line 42) | def KeepNumDims(self):
method AsymmetricQuantizeInputs (line 49) | def AsymmetricQuantizeInputs(self):
function FullyConnectedOptionsStart (line 55) | def FullyConnectedOptionsStart(builder): builder.StartObject(4)
function FullyConnectedOptionsAddFusedActivationFunction (line 56) | def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActiva...
function FullyConnectedOptionsAddWeightsFormat (line 57) | def FullyConnectedOptionsAddWeightsFormat(builder, weightsFormat): build...
function FullyConnectedOptionsAddKeepNumDims (line 58) | def FullyConnectedOptionsAddKeepNumDims(builder, keepNumDims): builder.P...
function FullyConnectedOptionsAddAsymmetricQuantizeInputs (line 59) | def FullyConnectedOptionsAddAsymmetricQuantizeInputs(builder, asymmetric...
function FullyConnectedOptionsEnd (line 60) | def FullyConnectedOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FullyConnectedOptionsWeightsFormat.py
class FullyConnectedOptionsWeightsFormat (line 5) | class FullyConnectedOptionsWeightsFormat(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GatherNdOptions.py
class GatherNdOptions (line 9) | class GatherNdOptions(object):
method GetRootAsGatherNdOptions (line 13) | def GetRootAsGatherNdOptions(cls, buf, offset):
method GatherNdOptionsBufferHasIdentifier (line 20) | def GatherNdOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function GatherNdOptionsStart (line 27) | def GatherNdOptionsStart(builder): builder.StartObject(0)
function GatherNdOptionsEnd (line 28) | def GatherNdOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GatherOptions.py
class GatherOptions (line 9) | class GatherOptions(object):
method GetRootAsGatherOptions (line 13) | def GetRootAsGatherOptions(cls, buf, offset):
method GatherOptionsBufferHasIdentifier (line 20) | def GatherOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method Axis (line 28) | def Axis(self):
function GatherOptionsStart (line 34) | def GatherOptionsStart(builder): builder.StartObject(1)
function GatherOptionsAddAxis (line 35) | def GatherOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axi...
function GatherOptionsEnd (line 36) | def GatherOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GreaterEqualOptions.py
class GreaterEqualOptions (line 9) | class GreaterEqualOptions(object):
method GetRootAsGreaterEqualOptions (line 13) | def GetRootAsGreaterEqualOptions(cls, buf, offset):
method GreaterEqualOptionsBufferHasIdentifier (line 20) | def GreaterEqualOptionsBufferHasIdentifier(cls, buf, offset, size_pref...
method Init (line 24) | def Init(self, buf, pos):
function GreaterEqualOptionsStart (line 27) | def GreaterEqualOptionsStart(builder): builder.StartObject(0)
function GreaterEqualOptionsEnd (line 28) | def GreaterEqualOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GreaterOptions.py
class GreaterOptions (line 9) | class GreaterOptions(object):
method GetRootAsGreaterOptions (line 13) | def GetRootAsGreaterOptions(cls, buf, offset):
method GreaterOptionsBufferHasIdentifier (line 20) | def GreaterOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=...
method Init (line 24) | def Init(self, buf, pos):
function GreaterOptionsStart (line 27) | def GreaterOptionsStart(builder): builder.StartObject(0)
function GreaterOptionsEnd (line 28) | def GreaterOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/HardSwishOptions.py
class HardSwishOptions (line 9) | class HardSwishOptions(object):
method GetRootAsHardSwishOptions (line 13) | def GetRootAsHardSwishOptions(cls, buf, offset):
method HardSwishOptionsBufferHasIdentifier (line 20) | def HardSwishOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
function HardSwishOptionsStart (line 27) | def HardSwishOptionsStart(builder): builder.StartObject(0)
function HardSwishOptionsEnd (line 28) | def HardSwishOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/IfOptions.py
class IfOptions (line 9) | class IfOptions(object):
method GetRootAsIfOptions (line 13) | def GetRootAsIfOptions(cls, buf, offset):
method IfOptionsBufferHasIdentifier (line 20) | def IfOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method ThenSubgraphIndex (line 28) | def ThenSubgraphIndex(self):
method ElseSubgraphIndex (line 35) | def ElseSubgraphIndex(self):
function IfOptionsStart (line 41) | def IfOptionsStart(builder): builder.StartObject(2)
function IfOptionsAddThenSubgraphIndex (line 42) | def IfOptionsAddThenSubgraphIndex(builder, thenSubgraphIndex): builder.P...
function IfOptionsAddElseSubgraphIndex (line 43) | def IfOptionsAddElseSubgraphIndex(builder, elseSubgraphIndex): builder.P...
function IfOptionsEnd (line 44) | def IfOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Int32Vector.py
class Int32Vector (line 9) | class Int32Vector(object):
method GetRootAsInt32Vector (line 13) | def GetRootAsInt32Vector(cls, buf, offset):
method Int32VectorBufferHasIdentifier (line 20) | def Int32VectorBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method Values (line 28) | def Values(self, j):
method ValuesAsNumpy (line 36) | def ValuesAsNumpy(self):
method ValuesLength (line 43) | def ValuesLength(self):
method ValuesIsNone (line 50) | def ValuesIsNone(self):
function Int32VectorStart (line 54) | def Int32VectorStart(builder): builder.StartObject(1)
function Int32VectorAddValues (line 55) | def Int32VectorAddValues(builder, values): builder.PrependUOffsetTRelati...
function Int32VectorStartValuesVector (line 56) | def Int32VectorStartValuesVector(builder, numElems): return builder.Star...
function Int32VectorEnd (line 57) | def Int32VectorEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/L2NormOptions.py
class L2NormOptions (line 9) | class L2NormOptions(object):
method GetRootAsL2NormOptions (line 13) | def GetRootAsL2NormOptions(cls, buf, offset):
method L2NormOptionsBufferHasIdentifier (line 20) | def L2NormOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
function L2NormOptionsStart (line 34) | def L2NormOptionsStart(builder): builder.StartObject(1)
function L2NormOptionsAddFusedActivationFunction (line 35) | def L2NormOptionsAddFusedActivationFunction(builder, fusedActivationFunc...
function L2NormOptionsEnd (line 36) | def L2NormOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSHProjectionOptions.py
class LSHProjectionOptions (line 9) | class LSHProjectionOptions(object):
method GetRootAsLSHProjectionOptions (line 13) | def GetRootAsLSHProjectionOptions(cls, buf, offset):
method LSHProjectionOptionsBufferHasIdentifier (line 20) | def LSHProjectionOptionsBufferHasIdentifier(cls, buf, offset, size_pre...
method Init (line 24) | def Init(self, buf, pos):
method Type (line 28) | def Type(self):
function LSHProjectionOptionsStart (line 34) | def LSHProjectionOptionsStart(builder): builder.StartObject(1)
function LSHProjectionOptionsAddType (line 35) | def LSHProjectionOptionsAddType(builder, type): builder.PrependInt8Slot(...
function LSHProjectionOptionsEnd (line 36) | def LSHProjectionOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSHProjectionType.py
class LSHProjectionType (line 5) | class LSHProjectionType(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSTMKernelType.py
class LSTMKernelType (line 5) | class LSTMKernelType(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSTMOptions.py
class LSTMOptions (line 9) | class LSTMOptions(object):
method GetRootAsLSTMOptions (line 13) | def GetRootAsLSTMOptions(cls, buf, offset):
method LSTMOptionsBufferHasIdentifier (line 20) | def LSTMOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
method CellClip (line 35) | def CellClip(self):
method ProjClip (line 42) | def ProjClip(self):
method KernelType (line 49) | def KernelType(self):
method AsymmetricQuantizeInputs (line 56) | def AsymmetricQuantizeInputs(self):
function LSTMOptionsStart (line 62) | def LSTMOptionsStart(builder): builder.StartObject(5)
function LSTMOptionsAddFusedActivationFunction (line 63) | def LSTMOptionsAddFusedActivationFunction(builder, fusedActivationFuncti...
function LSTMOptionsAddCellClip (line 64) | def LSTMOptionsAddCellClip(builder, cellClip): builder.PrependFloat32Slo...
function LSTMOptionsAddProjClip (line 65) | def LSTMOptionsAddProjClip(builder, projClip): builder.PrependFloat32Slo...
function LSTMOptionsAddKernelType (line 66) | def LSTMOptionsAddKernelType(builder, kernelType): builder.PrependInt8Sl...
function LSTMOptionsAddAsymmetricQuantizeInputs (line 67) | def LSTMOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeIn...
function LSTMOptionsEnd (line 68) | def LSTMOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LeakyReluOptions.py
class LeakyReluOptions (line 9) | class LeakyReluOptions(object):
method GetRootAsLeakyReluOptions (line 13) | def GetRootAsLeakyReluOptions(cls, buf, offset):
method LeakyReluOptionsBufferHasIdentifier (line 20) | def LeakyReluOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
method Alpha (line 28) | def Alpha(self):
function LeakyReluOptionsStart (line 34) | def LeakyReluOptionsStart(builder): builder.StartObject(1)
function LeakyReluOptionsAddAlpha (line 35) | def LeakyReluOptionsAddAlpha(builder, alpha): builder.PrependFloat32Slot...
function LeakyReluOptionsEnd (line 36) | def LeakyReluOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LessEqualOptions.py
class LessEqualOptions (line 9) | class LessEqualOptions(object):
method GetRootAsLessEqualOptions (line 13) | def GetRootAsLessEqualOptions(cls, buf, offset):
method LessEqualOptionsBufferHasIdentifier (line 20) | def LessEqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
function LessEqualOptionsStart (line 27) | def LessEqualOptionsStart(builder): builder.StartObject(0)
function LessEqualOptionsEnd (line 28) | def LessEqualOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LessOptions.py
class LessOptions (line 9) | class LessOptions(object):
method GetRootAsLessOptions (line 13) | def GetRootAsLessOptions(cls, buf, offset):
method LessOptionsBufferHasIdentifier (line 20) | def LessOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
function LessOptionsStart (line 27) | def LessOptionsStart(builder): builder.StartObject(0)
function LessOptionsEnd (line 28) | def LessOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LocalResponseNormalizationOptions.py
class LocalResponseNormalizationOptions (line 9) | class LocalResponseNormalizationOptions(object):
method GetRootAsLocalResponseNormalizationOptions (line 13) | def GetRootAsLocalResponseNormalizationOptions(cls, buf, offset):
method LocalResponseNormalizationOptionsBufferHasIdentifier (line 20) | def LocalResponseNormalizationOptionsBufferHasIdentifier(cls, buf, off...
method Init (line 24) | def Init(self, buf, pos):
method Radius (line 28) | def Radius(self):
method Bias (line 35) | def Bias(self):
method Alpha (line 42) | def Alpha(self):
method Beta (line 49) | def Beta(self):
function LocalResponseNormalizationOptionsStart (line 55) | def LocalResponseNormalizationOptionsStart(builder): builder.StartObject(4)
function LocalResponseNormalizationOptionsAddRadius (line 56) | def LocalResponseNormalizationOptionsAddRadius(builder, radius): builder...
function LocalResponseNormalizationOptionsAddBias (line 57) | def LocalResponseNormalizationOptionsAddBias(builder, bias): builder.Pre...
function LocalResponseNormalizationOptionsAddAlpha (line 58) | def LocalResponseNormalizationOptionsAddAlpha(builder, alpha): builder.P...
function LocalResponseNormalizationOptionsAddBeta (line 59) | def LocalResponseNormalizationOptionsAddBeta(builder, beta): builder.Pre...
function LocalResponseNormalizationOptionsEnd (line 60) | def LocalResponseNormalizationOptionsEnd(builder): return builder.EndObj...
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogSoftmaxOptions.py
class LogSoftmaxOptions (line 9) | class LogSoftmaxOptions(object):
method GetRootAsLogSoftmaxOptions (line 13) | def GetRootAsLogSoftmaxOptions(cls, buf, offset):
method LogSoftmaxOptionsBufferHasIdentifier (line 20) | def LogSoftmaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function LogSoftmaxOptionsStart (line 27) | def LogSoftmaxOptionsStart(builder): builder.StartObject(0)
function LogSoftmaxOptionsEnd (line 28) | def LogSoftmaxOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalAndOptions.py
class LogicalAndOptions (line 9) | class LogicalAndOptions(object):
method GetRootAsLogicalAndOptions (line 13) | def GetRootAsLogicalAndOptions(cls, buf, offset):
method LogicalAndOptionsBufferHasIdentifier (line 20) | def LogicalAndOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function LogicalAndOptionsStart (line 27) | def LogicalAndOptionsStart(builder): builder.StartObject(0)
function LogicalAndOptionsEnd (line 28) | def LogicalAndOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalNotOptions.py
class LogicalNotOptions (line 9) | class LogicalNotOptions(object):
method GetRootAsLogicalNotOptions (line 13) | def GetRootAsLogicalNotOptions(cls, buf, offset):
method LogicalNotOptionsBufferHasIdentifier (line 20) | def LogicalNotOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function LogicalNotOptionsStart (line 27) | def LogicalNotOptionsStart(builder): builder.StartObject(0)
function LogicalNotOptionsEnd (line 28) | def LogicalNotOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalOrOptions.py
class LogicalOrOptions (line 9) | class LogicalOrOptions(object):
method GetRootAsLogicalOrOptions (line 13) | def GetRootAsLogicalOrOptions(cls, buf, offset):
method LogicalOrOptionsBufferHasIdentifier (line 20) | def LogicalOrOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
function LogicalOrOptionsStart (line 27) | def LogicalOrOptionsStart(builder): builder.StartObject(0)
function LogicalOrOptionsEnd (line 28) | def LogicalOrOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MatrixDiagOptions.py
class MatrixDiagOptions (line 9) | class MatrixDiagOptions(object):
method GetRootAsMatrixDiagOptions (line 13) | def GetRootAsMatrixDiagOptions(cls, buf, offset):
method MatrixDiagOptionsBufferHasIdentifier (line 20) | def MatrixDiagOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function MatrixDiagOptionsStart (line 27) | def MatrixDiagOptionsStart(builder): builder.StartObject(0)
function MatrixDiagOptionsEnd (line 28) | def MatrixDiagOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MatrixSetDiagOptions.py
class MatrixSetDiagOptions (line 9) | class MatrixSetDiagOptions(object):
method GetRootAsMatrixSetDiagOptions (line 13) | def GetRootAsMatrixSetDiagOptions(cls, buf, offset):
method MatrixSetDiagOptionsBufferHasIdentifier (line 20) | def MatrixSetDiagOptionsBufferHasIdentifier(cls, buf, offset, size_pre...
method Init (line 24) | def Init(self, buf, pos):
function MatrixSetDiagOptionsStart (line 27) | def MatrixSetDiagOptionsStart(builder): builder.StartObject(0)
function MatrixSetDiagOptionsEnd (line 28) | def MatrixSetDiagOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MaximumMinimumOptions.py
class MaximumMinimumOptions (line 9) | class MaximumMinimumOptions(object):
method GetRootAsMaximumMinimumOptions (line 13) | def GetRootAsMaximumMinimumOptions(cls, buf, offset):
method MaximumMinimumOptionsBufferHasIdentifier (line 20) | def MaximumMinimumOptionsBufferHasIdentifier(cls, buf, offset, size_pr...
method Init (line 24) | def Init(self, buf, pos):
function MaximumMinimumOptionsStart (line 27) | def MaximumMinimumOptionsStart(builder): builder.StartObject(0)
function MaximumMinimumOptionsEnd (line 28) | def MaximumMinimumOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Metadata.py
class Metadata (line 9) | class Metadata(object):
method GetRootAsMetadata (line 13) | def GetRootAsMetadata(cls, buf, offset):
method MetadataBufferHasIdentifier (line 20) | def MetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method Name (line 28) | def Name(self):
method Buffer (line 35) | def Buffer(self):
function MetadataStart (line 41) | def MetadataStart(builder): builder.StartObject(2)
function MetadataAddName (line 42) | def MetadataAddName(builder, name): builder.PrependUOffsetTRelativeSlot(...
function MetadataAddBuffer (line 43) | def MetadataAddBuffer(builder, buffer): builder.PrependUint32Slot(1, buf...
function MetadataEnd (line 44) | def MetadataEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MirrorPadMode.py
class MirrorPadMode (line 5) | class MirrorPadMode(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MirrorPadOptions.py
class MirrorPadOptions (line 9) | class MirrorPadOptions(object):
method GetRootAsMirrorPadOptions (line 13) | def GetRootAsMirrorPadOptions(cls, buf, offset):
method MirrorPadOptionsBufferHasIdentifier (line 20) | def MirrorPadOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
method Mode (line 28) | def Mode(self):
function MirrorPadOptionsStart (line 34) | def MirrorPadOptionsStart(builder): builder.StartObject(1)
function MirrorPadOptionsAddMode (line 35) | def MirrorPadOptionsAddMode(builder, mode): builder.PrependInt8Slot(0, m...
function MirrorPadOptionsEnd (line 36) | def MirrorPadOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Model.py
class Model (line 9) | class Model(object):
method GetRootAsModel (line 13) | def GetRootAsModel(cls, buf, offset):
method ModelBufferHasIdentifier (line 20) | def ModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method Version (line 28) | def Version(self):
method OperatorCodes (line 35) | def OperatorCodes(self, j):
method OperatorCodesLength (line 48) | def OperatorCodesLength(self):
method OperatorCodesIsNone (line 55) | def OperatorCodesIsNone(self):
method Subgraphs (line 60) | def Subgraphs(self, j):
method SubgraphsLength (line 73) | def SubgraphsLength(self):
method SubgraphsIsNone (line 80) | def SubgraphsIsNone(self):
method Description (line 85) | def Description(self):
method Buffers (line 92) | def Buffers(self, j):
method BuffersLength (line 105) | def BuffersLength(self):
method BuffersIsNone (line 112) | def BuffersIsNone(self):
method MetadataBuffer (line 117) | def MetadataBuffer(self, j):
method MetadataBufferAsNumpy (line 125) | def MetadataBufferAsNumpy(self):
method MetadataBufferLength (line 132) | def MetadataBufferLength(self):
method MetadataBufferIsNone (line 139) | def MetadataBufferIsNone(self):
method Metadata (line 144) | def Metadata(self, j):
method MetadataLength (line 157) | def MetadataLength(self):
method MetadataIsNone (line 164) | def MetadataIsNone(self):
function ModelStart (line 168) | def ModelStart(builder): builder.StartObject(7)
function ModelAddVersion (line 169) | def ModelAddVersion(builder, version): builder.PrependUint32Slot(0, vers...
function ModelAddOperatorCodes (line 170) | def ModelAddOperatorCodes(builder, operatorCodes): builder.PrependUOffse...
function ModelStartOperatorCodesVector (line 171) | def ModelStartOperatorCodesVector(builder, numElems): return builder.Sta...
function ModelAddSubgraphs (line 172) | def ModelAddSubgraphs(builder, subgraphs): builder.PrependUOffsetTRelati...
function ModelStartSubgraphsVector (line 173) | def ModelStartSubgraphsVector(builder, numElems): return builder.StartVe...
function ModelAddDescription (line 174) | def ModelAddDescription(builder, description): builder.PrependUOffsetTRe...
function ModelAddBuffers (line 175) | def ModelAddBuffers(builder, buffers): builder.PrependUOffsetTRelativeSl...
function ModelStartBuffersVector (line 176) | def ModelStartBuffersVector(builder, numElems): return builder.StartVect...
function ModelAddMetadataBuffer (line 177) | def ModelAddMetadataBuffer(builder, metadataBuffer): builder.PrependUOff...
function ModelStartMetadataBufferVector (line 178) | def ModelStartMetadataBufferVector(builder, numElems): return builder.St...
function ModelAddMetadata (line 179) | def ModelAddMetadata(builder, metadata): builder.PrependUOffsetTRelative...
function ModelStartMetadataVector (line 180) | def ModelStartMetadataVector(builder, numElems): return builder.StartVec...
function ModelEnd (line 181) | def ModelEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MulOptions.py
class MulOptions (line 9) | class MulOptions(object):
method GetRootAsMulOptions (line 13) | def GetRootAsMulOptions(cls, buf, offset):
method MulOptionsBufferHasIdentifier (line 20) | def MulOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
function MulOptionsStart (line 34) | def MulOptionsStart(builder): builder.StartObject(1)
function MulOptionsAddFusedActivationFunction (line 35) | def MulOptionsAddFusedActivationFunction(builder, fusedActivationFunctio...
function MulOptionsEnd (line 36) | def MulOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NegOptions.py
class NegOptions (line 9) | class NegOptions(object):
method GetRootAsNegOptions (line 13) | def GetRootAsNegOptions(cls, buf, offset):
method NegOptionsBufferHasIdentifier (line 20) | def NegOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function NegOptionsStart (line 27) | def NegOptionsStart(builder): builder.StartObject(0)
function NegOptionsEnd (line 28) | def NegOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NonMaxSuppressionV4Options.py
class NonMaxSuppressionV4Options (line 9) | class NonMaxSuppressionV4Options(object):
method GetRootAsNonMaxSuppressionV4Options (line 13) | def GetRootAsNonMaxSuppressionV4Options(cls, buf, offset):
method NonMaxSuppressionV4OptionsBufferHasIdentifier (line 20) | def NonMaxSuppressionV4OptionsBufferHasIdentifier(cls, buf, offset, si...
method Init (line 24) | def Init(self, buf, pos):
function NonMaxSuppressionV4OptionsStart (line 27) | def NonMaxSuppressionV4OptionsStart(builder): builder.StartObject(0)
function NonMaxSuppressionV4OptionsEnd (line 28) | def NonMaxSuppressionV4OptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NonMaxSuppressionV5Options.py
class NonMaxSuppressionV5Options (line 9) | class NonMaxSuppressionV5Options(object):
method GetRootAsNonMaxSuppressionV5Options (line 13) | def GetRootAsNonMaxSuppressionV5Options(cls, buf, offset):
method NonMaxSuppressionV5OptionsBufferHasIdentifier (line 20) | def NonMaxSuppressionV5OptionsBufferHasIdentifier(cls, buf, offset, si...
method Init (line 24) | def Init(self, buf, pos):
function NonMaxSuppressionV5OptionsStart (line 27) | def NonMaxSuppressionV5OptionsStart(builder): builder.StartObject(0)
function NonMaxSuppressionV5OptionsEnd (line 28) | def NonMaxSuppressionV5OptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NotEqualOptions.py
class NotEqualOptions (line 9) | class NotEqualOptions(object):
method GetRootAsNotEqualOptions (line 13) | def GetRootAsNotEqualOptions(cls, buf, offset):
method NotEqualOptionsBufferHasIdentifier (line 20) | def NotEqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function NotEqualOptionsStart (line 27) | def NotEqualOptionsStart(builder): builder.StartObject(0)
function NotEqualOptionsEnd (line 28) | def NotEqualOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/OneHotOptions.py
class OneHotOptions (line 9) | class OneHotOptions(object):
method GetRootAsOneHotOptions (line 13) | def GetRootAsOneHotOptions(cls, buf, offset):
method OneHotOptionsBufferHasIdentifier (line 20) | def OneHotOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method Axis (line 28) | def Axis(self):
function OneHotOptionsStart (line 34) | def OneHotOptionsStart(builder): builder.StartObject(1)
function OneHotOptionsAddAxis (line 35) | def OneHotOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axi...
function OneHotOptionsEnd (line 36) | def OneHotOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Operator.py
class Operator (line 9) | class Operator(object):
method GetRootAsOperator (line 13) | def GetRootAsOperator(cls, buf, offset):
method OperatorBufferHasIdentifier (line 20) | def OperatorBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method OpcodeIndex (line 28) | def OpcodeIndex(self):
method Inputs (line 35) | def Inputs(self, j):
method InputsAsNumpy (line 43) | def InputsAsNumpy(self):
method InputsLength (line 50) | def InputsLength(self):
method InputsIsNone (line 57) | def InputsIsNone(self):
method Outputs (line 62) | def Outputs(self, j):
method OutputsAsNumpy (line 70) | def OutputsAsNumpy(self):
method OutputsLength (line 77) | def OutputsLength(self):
method OutputsIsNone (line 84) | def OutputsIsNone(self):
method BuiltinOptionsType (line 89) | def BuiltinOptionsType(self):
method BuiltinOptions (line 96) | def BuiltinOptions(self):
method CustomOptions (line 106) | def CustomOptions(self, j):
method CustomOptionsAsNumpy (line 114) | def CustomOptionsAsNumpy(self):
method CustomOptionsLength (line 121) | def CustomOptionsLength(self):
method CustomOptionsIsNone (line 128) | def CustomOptionsIsNone(self):
method CustomOptionsFormat (line 133) | def CustomOptionsFormat(self):
method MutatingVariableInputs (line 140) | def MutatingVariableInputs(self, j):
method MutatingVariableInputsAsNumpy (line 148) | def MutatingVariableInputsAsNumpy(self):
method MutatingVariableInputsLength (line 155) | def MutatingVariableInputsLength(self):
method MutatingVariableInputsIsNone (line 162) | def MutatingVariableInputsIsNone(self):
method Intermediates (line 167) | def Intermediates(self, j):
method IntermediatesAsNumpy (line 175) | def IntermediatesAsNumpy(self):
method IntermediatesLength (line 182) | def IntermediatesLength(self):
method IntermediatesIsNone (line 189) | def IntermediatesIsNone(self):
function OperatorStart (line 193) | def OperatorStart(builder): builder.StartObject(9)
function OperatorAddOpcodeIndex (line 194) | def OperatorAddOpcodeIndex(builder, opcodeIndex): builder.PrependUint32S...
function OperatorAddInputs (line 195) | def OperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeS...
function OperatorStartInputsVector (line 196) | def OperatorStartInputsVector(builder, numElems): return builder.StartVe...
function OperatorAddOutputs (line 197) | def OperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativ...
function OperatorStartOutputsVector (line 198) | def OperatorStartOutputsVector(builder, numElems): return builder.StartV...
function OperatorAddBuiltinOptionsType (line 199) | def OperatorAddBuiltinOptionsType(builder, builtinOptionsType): builder....
function OperatorAddBuiltinOptions (line 200) | def OperatorAddBuiltinOptions(builder, builtinOptions): builder.PrependU...
function OperatorAddCustomOptions (line 201) | def OperatorAddCustomOptions(builder, customOptions): builder.PrependUOf...
function OperatorStartCustomOptionsVector (line 202) | def OperatorStartCustomOptionsVector(builder, numElems): return builder....
function OperatorAddCustomOptionsFormat (line 203) | def OperatorAddCustomOptionsFormat(builder, customOptionsFormat): builde...
function OperatorAddMutatingVariableInputs (line 204) | def OperatorAddMutatingVariableInputs(builder, mutatingVariableInputs): ...
function OperatorStartMutatingVariableInputsVector (line 205) | def OperatorStartMutatingVariableInputsVector(builder, numElems): return...
function OperatorAddIntermediates (line 206) | def OperatorAddIntermediates(builder, intermediates): builder.PrependUOf...
function OperatorStartIntermediatesVector (line 207) | def OperatorStartIntermediatesVector(builder, numElems): return builder....
function OperatorEnd (line 208) | def OperatorEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/OperatorCode.py
class OperatorCode (line 9) | class OperatorCode(object):
method GetRootAsOperatorCode (line 13) | def GetRootAsOperatorCode(cls, buf, offset):
method OperatorCodeBufferHasIdentifier (line 20) | def OperatorCodeBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
method BuiltinCode (line 28) | def BuiltinCode(self):
method CustomCode (line 35) | def CustomCode(self):
method Version (line 42) | def Version(self):
function OperatorCodeStart (line 48) | def OperatorCodeStart(builder): builder.StartObject(3)
function OperatorCodeAddBuiltinCode (line 49) | def OperatorCodeAddBuiltinCode(builder, builtinCode): builder.PrependInt...
function OperatorCodeAddCustomCode (line 50) | def OperatorCodeAddCustomCode(builder, customCode): builder.PrependUOffs...
function OperatorCodeAddVersion (line 51) | def OperatorCodeAddVersion(builder, version): builder.PrependInt32Slot(2...
function OperatorCodeEnd (line 52) | def OperatorCodeEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PackOptions.py
class PackOptions (line 9) | class PackOptions(object):
method GetRootAsPackOptions (line 13) | def GetRootAsPackOptions(cls, buf, offset):
method PackOptionsBufferHasIdentifier (line 20) | def PackOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method ValuesCount (line 28) | def ValuesCount(self):
method Axis (line 35) | def Axis(self):
function PackOptionsStart (line 41) | def PackOptionsStart(builder): builder.StartObject(2)
function PackOptionsAddValuesCount (line 42) | def PackOptionsAddValuesCount(builder, valuesCount): builder.PrependInt3...
function PackOptionsAddAxis (line 43) | def PackOptionsAddAxis(builder, axis): builder.PrependInt32Slot(1, axis, 0)
function PackOptionsEnd (line 44) | def PackOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PadOptions.py
class PadOptions (line 9) | class PadOptions(object):
method GetRootAsPadOptions (line 13) | def GetRootAsPadOptions(cls, buf, offset):
method PadOptionsBufferHasIdentifier (line 20) | def PadOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function PadOptionsStart (line 27) | def PadOptionsStart(builder): builder.StartObject(0)
function PadOptionsEnd (line 28) | def PadOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PadV2Options.py
class PadV2Options (line 9) | class PadV2Options(object):
method GetRootAsPadV2Options (line 13) | def GetRootAsPadV2Options(cls, buf, offset):
method PadV2OptionsBufferHasIdentifier (line 20) | def PadV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
function PadV2OptionsStart (line 27) | def PadV2OptionsStart(builder): builder.StartObject(0)
function PadV2OptionsEnd (line 28) | def PadV2OptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Padding.py
class Padding (line 5) | class Padding(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Pool2DOptions.py
class Pool2DOptions (line 9) | class Pool2DOptions(object):
method GetRootAsPool2DOptions (line 13) | def GetRootAsPool2DOptions(cls, buf, offset):
method Pool2DOptionsBufferHasIdentifier (line 20) | def Pool2DOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
method Padding (line 28) | def Padding(self):
method StrideW (line 35) | def StrideW(self):
method StrideH (line 42) | def StrideH(self):
method FilterWidth (line 49) | def FilterWidth(self):
method FilterHeight (line 56) | def FilterHeight(self):
method FusedActivationFunction (line 63) | def FusedActivationFunction(self):
function Pool2DOptionsStart (line 69) | def Pool2DOptionsStart(builder): builder.StartObject(6)
function Pool2DOptionsAddPadding (line 70) | def Pool2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0...
function Pool2DOptionsAddStrideW (line 71) | def Pool2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(...
function Pool2DOptionsAddStrideH (line 72) | def Pool2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(...
function Pool2DOptionsAddFilterWidth (line 73) | def Pool2DOptionsAddFilterWidth(builder, filterWidth): builder.PrependIn...
function Pool2DOptionsAddFilterHeight (line 74) | def Pool2DOptionsAddFilterHeight(builder, filterHeight): builder.Prepend...
function Pool2DOptionsAddFusedActivationFunction (line 75) | def Pool2DOptionsAddFusedActivationFunction(builder, fusedActivationFunc...
function Pool2DOptionsEnd (line 76) | def Pool2DOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PowOptions.py
class PowOptions (line 9) | class PowOptions(object):
method GetRootAsPowOptions (line 13) | def GetRootAsPowOptions(cls, buf, offset):
method PowOptionsBufferHasIdentifier (line 20) | def PowOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
function PowOptionsStart (line 27) | def PowOptionsStart(builder): builder.StartObject(0)
function PowOptionsEnd (line 28) | def PowOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizationDetails.py
class QuantizationDetails (line 5) | class QuantizationDetails(object):
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizationParameters.py
class QuantizationParameters (line 9) | class QuantizationParameters(object):
method GetRootAsQuantizationParameters (line 13) | def GetRootAsQuantizationParameters(cls, buf, offset):
method QuantizationParametersBufferHasIdentifier (line 20) | def QuantizationParametersBufferHasIdentifier(cls, buf, offset, size_p...
method Init (line 24) | def Init(self, buf, pos):
method Min (line 28) | def Min(self, j):
method MinAsNumpy (line 36) | def MinAsNumpy(self):
method MinLength (line 43) | def MinLength(self):
method MinIsNone (line 50) | def MinIsNone(self):
method Max (line 55) | def Max(self, j):
method MaxAsNumpy (line 63) | def MaxAsNumpy(self):
method MaxLength (line 70) | def MaxLength(self):
method MaxIsNone (line 77) | def MaxIsNone(self):
method Scale (line 82) | def Scale(self, j):
method ScaleAsNumpy (line 90) | def ScaleAsNumpy(self):
method ScaleLength (line 97) | def ScaleLength(self):
method ScaleIsNone (line 104) | def ScaleIsNone(self):
method ZeroPoint (line 109) | def ZeroPoint(self, j):
method ZeroPointAsNumpy (line 117) | def ZeroPointAsNumpy(self):
method ZeroPointLength (line 124) | def ZeroPointLength(self):
method ZeroPointIsNone (line 131) | def ZeroPointIsNone(self):
method DetailsType (line 136) | def DetailsType(self):
method Details (line 143) | def Details(self):
method QuantizedDimension (line 153) | def QuantizedDimension(self):
function QuantizationParametersStart (line 159) | def QuantizationParametersStart(builder): builder.StartObject(7)
function QuantizationParametersAddMin (line 160) | def QuantizationParametersAddMin(builder, min): builder.PrependUOffsetTR...
function QuantizationParametersStartMinVector (line 161) | def QuantizationParametersStartMinVector(builder, numElems): return buil...
function QuantizationParametersAddMax (line 162) | def QuantizationParametersAddMax(builder, max): builder.PrependUOffsetTR...
function QuantizationParametersStartMaxVector (line 163) | def QuantizationParametersStartMaxVector(builder, numElems): return buil...
function QuantizationParametersAddScale (line 164) | def QuantizationParametersAddScale(builder, scale): builder.PrependUOffs...
function QuantizationParametersStartScaleVector (line 165) | def QuantizationParametersStartScaleVector(builder, numElems): return bu...
function QuantizationParametersAddZeroPoint (line 166) | def QuantizationParametersAddZeroPoint(builder, zeroPoint): builder.Prep...
function QuantizationParametersStartZeroPointVector (line 167) | def QuantizationParametersStartZeroPointVector(builder, numElems): retur...
function QuantizationParametersAddDetailsType (line 168) | def QuantizationParametersAddDetailsType(builder, detailsType): builder....
function QuantizationParametersAddDetails (line 169) | def QuantizationParametersAddDetails(builder, details): builder.PrependU...
function QuantizationParametersAddQuantizedDimension (line 170) | def QuantizationParametersAddQuantizedDimension(builder, quantizedDimens...
function QuantizationParametersEnd (line 171) | def QuantizationParametersEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizeOptions.py
class QuantizeOptions (line 9) | class QuantizeOptions(object):
method GetRootAsQuantizeOptions (line 13) | def GetRootAsQuantizeOptions(cls, buf, offset):
method QuantizeOptionsBufferHasIdentifier (line 20) | def QuantizeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function QuantizeOptionsStart (line 27) | def QuantizeOptionsStart(builder): builder.StartObject(0)
function QuantizeOptionsEnd (line 28) | def QuantizeOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/RNNOptions.py
class RNNOptions (line 9) | class RNNOptions(object):
method GetRootAsRNNOptions (line 13) | def GetRootAsRNNOptions(cls, buf, offset):
method RNNOptionsBufferHasIdentifier (line 20) | def RNNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
method Init (line 24) | def Init(self, buf, pos):
method FusedActivationFunction (line 28) | def FusedActivationFunction(self):
method AsymmetricQuantizeInputs (line 35) | def AsymmetricQuantizeInputs(self):
function RNNOptionsStart (line 41) | def RNNOptionsStart(builder): builder.StartObject(2)
function RNNOptionsAddFusedActivationFunction (line 42) | def RNNOptionsAddFusedActivationFunction(builder, fusedActivationFunctio...
function RNNOptionsAddAsymmetricQuantizeInputs (line 43) | def RNNOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInp...
function RNNOptionsEnd (line 44) | def RNNOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/RangeOptions.py
class RangeOptions (line 9) | class RangeOptions(object):
method GetRootAsRangeOptions (line 13) | def GetRootAsRangeOptions(cls, buf, offset):
method RangeOptionsBufferHasIdentifier (line 20) | def RangeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
function RangeOptionsStart (line 27) | def RangeOptionsStart(builder): builder.StartObject(0)
function RangeOptionsEnd (line 28) | def RangeOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/RankOptions.py
class RankOptions (line 9) | class RankOptions(object):
method GetRootAsRankOptions (line 13) | def GetRootAsRankOptions(cls, buf, offset):
method RankOptionsBufferHasIdentifier (line 20) | def RankOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
function RankOptionsStart (line 27) | def RankOptionsStart(builder): builder.StartObject(0)
function RankOptionsEnd (line 28) | def RankOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ReducerOptions.py
class ReducerOptions (line 9) | class ReducerOptions(object):
method GetRootAsReducerOptions (line 13) | def GetRootAsReducerOptions(cls, buf, offset):
method ReducerOptionsBufferHasIdentifier (line 20) | def ReducerOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=...
method Init (line 24) | def Init(self, buf, pos):
method KeepDims (line 28) | def KeepDims(self):
function ReducerOptionsStart (line 34) | def ReducerOptionsStart(builder): builder.StartObject(1)
function ReducerOptionsAddKeepDims (line 35) | def ReducerOptionsAddKeepDims(builder, keepDims): builder.PrependBoolSlo...
function ReducerOptionsEnd (line 36) | def ReducerOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ReshapeOptions.py
class ReshapeOptions (line 9) | class ReshapeOptions(object):
method GetRootAsReshapeOptions (line 13) | def GetRootAsReshapeOptions(cls, buf, offset):
method ReshapeOptionsBufferHasIdentifier (line 20) | def ReshapeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=...
method Init (line 24) | def Init(self, buf, pos):
method NewShape (line 28) | def NewShape(self, j):
method NewShapeAsNumpy (line 36) | def NewShapeAsNumpy(self):
method NewShapeLength (line 43) | def NewShapeLength(self):
method NewShapeIsNone (line 50) | def NewShapeIsNone(self):
function ReshapeOptionsStart (line 54) | def ReshapeOptionsStart(builder): builder.StartObject(1)
function ReshapeOptionsAddNewShape (line 55) | def ReshapeOptionsAddNewShape(builder, newShape): builder.PrependUOffset...
function ReshapeOptionsStartNewShapeVector (line 56) | def ReshapeOptionsStartNewShapeVector(builder, numElems): return builder...
function ReshapeOptionsEnd (line 57) | def ReshapeOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ResizeBilinearOptions.py
class ResizeBilinearOptions (line 9) | class ResizeBilinearOptions(object):
method GetRootAsResizeBilinearOptions (line 13) | def GetRootAsResizeBilinearOptions(cls, buf, offset):
method ResizeBilinearOptionsBufferHasIdentifier (line 20) | def ResizeBilinearOptionsBufferHasIdentifier(cls, buf, offset, size_pr...
method Init (line 24) | def Init(self, buf, pos):
method AlignCorners (line 28) | def AlignCorners(self):
method HalfPixelCenters (line 35) | def HalfPixelCenters(self):
function ResizeBilinearOptionsStart (line 41) | def ResizeBilinearOptionsStart(builder): builder.StartObject(4)
function ResizeBilinearOptionsAddAlignCorners (line 42) | def ResizeBilinearOptionsAddAlignCorners(builder, alignCorners): builder...
function ResizeBilinearOptionsAddHalfPixelCenters (line 43) | def ResizeBilinearOptionsAddHalfPixelCenters(builder, halfPixelCenters):...
function ResizeBilinearOptionsEnd (line 44) | def ResizeBilinearOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ResizeNearestNeighborOptions.py
class ResizeNearestNeighborOptions (line 9) | class ResizeNearestNeighborOptions(object):
method GetRootAsResizeNearestNeighborOptions (line 13) | def GetRootAsResizeNearestNeighborOptions(cls, buf, offset):
method ResizeNearestNeighborOptionsBufferHasIdentifier (line 20) | def ResizeNearestNeighborOptionsBufferHasIdentifier(cls, buf, offset, ...
method Init (line 24) | def Init(self, buf, pos):
method AlignCorners (line 28) | def AlignCorners(self):
method HalfPixelCenters (line 35) | def HalfPixelCenters(self):
function ResizeNearestNeighborOptionsStart (line 41) | def ResizeNearestNeighborOptionsStart(builder): builder.StartObject(2)
function ResizeNearestNeighborOptionsAddAlignCorners (line 42) | def ResizeNearestNeighborOptionsAddAlignCorners(builder, alignCorners): ...
function ResizeNearestNeighborOptionsAddHalfPixelCenters (line 43) | def ResizeNearestNeighborOptionsAddHalfPixelCenters(builder, halfPixelCe...
function ResizeNearestNeighborOptionsEnd (line 44) | def ResizeNearestNeighborOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ReverseSequenceOptions.py
class ReverseSequenceOptions (line 9) | class ReverseSequenceOptions(object):
method GetRootAsReverseSequenceOptions (line 13) | def GetRootAsReverseSequenceOptions(cls, buf, offset):
method ReverseSequenceOptionsBufferHasIdentifier (line 20) | def ReverseSequenceOptionsBufferHasIdentifier(cls, buf, offset, size_p...
method Init (line 24) | def Init(self, buf, pos):
method SeqDim (line 28) | def SeqDim(self):
method BatchDim (line 35) | def BatchDim(self):
function ReverseSequenceOptionsStart (line 41) | def ReverseSequenceOptionsStart(builder): builder.StartObject(2)
function ReverseSequenceOptionsAddSeqDim (line 42) | def ReverseSequenceOptionsAddSeqDim(builder, seqDim): builder.PrependInt...
function ReverseSequenceOptionsAddBatchDim (line 43) | def ReverseSequenceOptionsAddBatchDim(builder, batchDim): builder.Prepen...
function ReverseSequenceOptionsEnd (line 44) | def ReverseSequenceOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ReverseV2Options.py
class ReverseV2Options (line 9) | class ReverseV2Options(object):
method GetRootAsReverseV2Options (line 13) | def GetRootAsReverseV2Options(cls, buf, offset):
method ReverseV2OptionsBufferHasIdentifier (line 20) | def ReverseV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
function ReverseV2OptionsStart (line 27) | def ReverseV2OptionsStart(builder): builder.StartObject(0)
function ReverseV2OptionsEnd (line 28) | def ReverseV2OptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SVDFOptions.py
class SVDFOptions (line 9) | class SVDFOptions(object):
method GetRootAsSVDFOptions (line 13) | def GetRootAsSVDFOptions(cls, buf, offset):
method SVDFOptionsBufferHasIdentifier (line 20) | def SVDFOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fal...
method Init (line 24) | def Init(self, buf, pos):
method Rank (line 28) | def Rank(self):
method FusedActivationFunction (line 35) | def FusedActivationFunction(self):
method AsymmetricQuantizeInputs (line 42) | def AsymmetricQuantizeInputs(self):
function SVDFOptionsStart (line 48) | def SVDFOptionsStart(builder): builder.StartObject(3)
function SVDFOptionsAddRank (line 49) | def SVDFOptionsAddRank(builder, rank): builder.PrependInt32Slot(0, rank, 0)
function SVDFOptionsAddFusedActivationFunction (line 50) | def SVDFOptionsAddFusedActivationFunction(builder, fusedActivationFuncti...
function SVDFOptionsAddAsymmetricQuantizeInputs (line 51) | def SVDFOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeIn...
function SVDFOptionsEnd (line 52) | def SVDFOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ScatterNdOptions.py
class ScatterNdOptions (line 9) | class ScatterNdOptions(object):
method GetRootAsScatterNdOptions (line 13) | def GetRootAsScatterNdOptions(cls, buf, offset):
method ScatterNdOptionsBufferHasIdentifier (line 20) | def ScatterNdOptionsBufferHasIdentifier(cls, buf, offset, size_prefixe...
method Init (line 24) | def Init(self, buf, pos):
function ScatterNdOptionsStart (line 27) | def ScatterNdOptionsStart(builder): builder.StartObject(0)
function ScatterNdOptionsEnd (line 28) | def ScatterNdOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SegmentSumOptions.py
class SegmentSumOptions (line 9) | class SegmentSumOptions(object):
method GetRootAsSegmentSumOptions (line 13) | def GetRootAsSegmentSumOptions(cls, buf, offset):
method SegmentSumOptionsBufferHasIdentifier (line 20) | def SegmentSumOptionsBufferHasIdentifier(cls, buf, offset, size_prefix...
method Init (line 24) | def Init(self, buf, pos):
function SegmentSumOptionsStart (line 27) | def SegmentSumOptionsStart(builder): builder.StartObject(0)
function SegmentSumOptionsEnd (line 28) | def SegmentSumOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SelectOptions.py
class SelectOptions (line 9) | class SelectOptions(object):
method GetRootAsSelectOptions (line 13) | def GetRootAsSelectOptions(cls, buf, offset):
method SelectOptionsBufferHasIdentifier (line 20) | def SelectOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=F...
method Init (line 24) | def Init(self, buf, pos):
function SelectOptionsStart (line 27) | def SelectOptionsStart(builder): builder.StartObject(0)
function SelectOptionsEnd (line 28) | def SelectOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SelectV2Options.py
class SelectV2Options (line 9) | class SelectV2Options(object):
method GetRootAsSelectV2Options (line 13) | def GetRootAsSelectV2Options(cls, buf, offset):
method SelectV2OptionsBufferHasIdentifier (line 20) | def SelectV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
function SelectV2OptionsStart (line 27) | def SelectV2OptionsStart(builder): builder.StartObject(0)
function SelectV2OptionsEnd (line 28) | def SelectV2OptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SequenceRNNOptions.py
class SequenceRNNOptions (line 9) | class SequenceRNNOptions(object):
method GetRootAsSequenceRNNOptions (line 13) | def GetRootAsSequenceRNNOptions(cls, buf, offset):
method SequenceRNNOptionsBufferHasIdentifier (line 20) | def SequenceRNNOptionsBufferHasIdentifier(cls, buf, offset, size_prefi...
method Init (line 24) | def Init(self, buf, pos):
method TimeMajor (line 28) | def TimeMajor(self):
method FusedActivationFunction (line 35) | def FusedActivationFunction(self):
method AsymmetricQuantizeInputs (line 42) | def AsymmetricQuantizeInputs(self):
function SequenceRNNOptionsStart (line 48) | def SequenceRNNOptionsStart(builder): builder.StartObject(3)
function SequenceRNNOptionsAddTimeMajor (line 49) | def SequenceRNNOptionsAddTimeMajor(builder, timeMajor): builder.PrependB...
function SequenceRNNOptionsAddFusedActivationFunction (line 50) | def SequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivatio...
function SequenceRNNOptionsAddAsymmetricQuantizeInputs (line 51) | def SequenceRNNOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQua...
function SequenceRNNOptionsEnd (line 52) | def SequenceRNNOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ShapeOptions.py
class ShapeOptions (line 9) | class ShapeOptions(object):
method GetRootAsShapeOptions (line 13) | def GetRootAsShapeOptions(cls, buf, offset):
method ShapeOptionsBufferHasIdentifier (line 20) | def ShapeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
method OutType (line 28) | def OutType(self):
function ShapeOptionsStart (line 34) | def ShapeOptionsStart(builder): builder.StartObject(1)
function ShapeOptionsAddOutType (line 35) | def ShapeOptionsAddOutType(builder, outType): builder.PrependInt8Slot(0,...
function ShapeOptionsEnd (line 36) | def ShapeOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SkipGramOptions.py
class SkipGramOptions (line 9) | class SkipGramOptions(object):
method GetRootAsSkipGramOptions (line 13) | def GetRootAsSkipGramOptions(cls, buf, offset):
method SkipGramOptionsBufferHasIdentifier (line 20) | def SkipGramOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed...
method Init (line 24) | def Init(self, buf, pos):
method NgramSize (line 28) | def NgramSize(self):
method MaxSkipSize (line 35) | def MaxSkipSize(self):
method IncludeAllNgrams (line 42) | def IncludeAllNgrams(self):
function SkipGramOptionsStart (line 48) | def SkipGramOptionsStart(builder): builder.StartObject(3)
function SkipGramOptionsAddNgramSize (line 49) | def SkipGramOptionsAddNgramSize(builder, ngramSize): builder.PrependInt3...
function SkipGramOptionsAddMaxSkipSize (line 50) | def SkipGramOptionsAddMaxSkipSize(builder, maxSkipSize): builder.Prepend...
function SkipGramOptionsAddIncludeAllNgrams (line 51) | def SkipGramOptionsAddIncludeAllNgrams(builder, includeAllNgrams): build...
function SkipGramOptionsEnd (line 52) | def SkipGramOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SliceOptions.py
class SliceOptions (line 9) | class SliceOptions(object):
method GetRootAsSliceOptions (line 13) | def GetRootAsSliceOptions(cls, buf, offset):
method SliceOptionsBufferHasIdentifier (line 20) | def SliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=Fa...
method Init (line 24) | def Init(self, buf, pos):
function SliceOptionsStart (line 27) | def SliceOptionsStart(builder): builder.StartObject(0)
function SliceOptionsEnd (line 28) | def SliceOptionsEnd(builder): return builder.EndObject()
FILE: nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/SoftmaxOptions.py
class SoftmaxOptions (line 9) | class SoftmaxOptions(object):
method GetRootAsSoftmaxOptions (line 13) | def GetRootAsSoftmaxOptions(cls, buf, offset):
method SoftmaxOptionsBufferHasIdentifier (line 20) | def SoftmaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=...
method Init (line 24) | def Init(self, buf, pos):
method Beta (line 28) | def Beta(self):
function SoftmaxOptionsStart (line 34) | def SoftmaxOptionsStart(builder): builder.StartObject(1)
function SoftmaxOptionsAddBeta (line 35) | def SoftmaxOptionsAddBeta(builder,
Condensed preview — 269 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,116K chars).
[
{
"path": ".github/workflows/build_nnef.yml",
"chars": 1827,
"preview": "name: Build, test and publish nnef\n\non:\n push:\n tags:\n - 'nnef-v[0-9]+.[0-9]+.[0-9]+'\n\n\njobs:\n build_wheels:\n "
},
{
"path": ".github/workflows/build_nnef_tools.yml",
"chars": 1122,
"preview": "name: Build, test and publish nnef_tools\n\non:\n push:\n tags:\n - 'nnef_tools-v[0-9]+.[0-9]+.[0-9]+'\n\n\njobs:\n bui"
},
{
"path": ".gitignore",
"chars": 66,
"preview": "*.pyc\n__pycache__\n.idea\n/_models\n/out\n/*/build\n/*/dist\n*.egg-info\n"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 280,
"preview": "A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of "
},
{
"path": "README.md",
"chars": 5238,
"preview": "[](https://opensource.org/licenses/Apache-2.0)\n\n<p"
},
{
"path": "_config.yml",
"chars": 25,
"preview": "theme: jekyll-theme-slate"
},
{
"path": "fix_nnef_binary_size.py",
"chars": 2216,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "models/README.md",
"chars": 9975,
"preview": "NNEF model zoo\n==============\n\nThe following collection of models were compiled by running the converter tools in this r"
},
{
"path": "nnef-pyproject/README.md",
"chars": 873,
"preview": "NNEF Parser - repository\n===================\n\n\nIntroduction\n------------\n\nThe code consists of a C++ library that contai"
},
{
"path": "nnef-pyproject/cpp_api.md",
"chars": 971,
"preview": "\nBuilding the C++ library\n------------------------\n\nThe C++ library can be compiled with cmake.\nThe `examples/samples/sa"
},
{
"path": "nnef-pyproject/examples/alexnet.txt",
"chars": 3460,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/googlenet.txt",
"chars": 22456,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/resnet.txt",
"chars": 28478,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/samples/sample.py",
"chars": 973,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/samples/sample_ext.py",
"chars": 1386,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/samples/sample_gen.py",
"chars": 1748,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/examples/vgg.txt",
"chars": 6894,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/__init__.py",
"chars": 4753,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/binary.py",
"chars": 7654,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/cpp/CMakeLists.txt",
"chars": 2919,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/cpp/include/cnnef.h",
"chars": 5481,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/binary.h",
"chars": 8548,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/dictionary.h",
"chars": 826,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/error.h",
"chars": 2430,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/lexer.h",
"chars": 10755,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/parser.h",
"chars": 4790,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/prototype.h",
"chars": 5522,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/shapes.h",
"chars": 39075,
"preview": "/*\n* Copyright (c) 2017 The Khronos Group Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/typespec.h",
"chars": 7154,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/typeutils.h",
"chars": 9359,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/common/value.h",
"chars": 14731,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/comp/comp_parser.h",
"chars": 66303,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/comp/evaluation.h",
"chars": 44875,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/comp/expression.h",
"chars": 15526,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/comp/fragment.h",
"chars": 2668,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/comp/stdlib_source.h",
"chars": 22442,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/flat/flat_parser.h",
"chars": 25425,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/flat/quant_parser.h",
"chars": 3080,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/flat/stdlib_protos.h",
"chars": 30496,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/runtime/execution.h",
"chars": 34348,
"preview": "/*\n* Copyright (c) 2017 The Khronos Group Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/runtime/ndrange.h",
"chars": 5475,
"preview": "/*\n* Copyright (c) 2017 The Khronos Group Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef/runtime/operations.h",
"chars": 32296,
"preview": "/*\n* Copyright (c) 2017 The Khronos Group Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you"
},
{
"path": "nnef-pyproject/nnef/cpp/include/nnef.h",
"chars": 8180,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/infer.cpp",
"chars": 8442,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/sample.cpp",
"chars": 1262,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/src/cnnef.cpp",
"chars": 5585,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/cpp/src/nnef.cpp",
"chars": 29095,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/nnef.cpp",
"chars": 22151,
"preview": "/*\n * Copyright (c) 2017 The Khronos Group Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n *"
},
{
"path": "nnef-pyproject/nnef/parser.py",
"chars": 950,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/printer.py",
"chars": 3782,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/shapes.py",
"chars": 29008,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/nnef/validate.py",
"chars": 2906,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/package_info.md",
"chars": 1038,
"preview": "NNEF Parser Project\n===================\n\nThis package contains a sample NNEF parser, using a C++ backend.\n\n\nUsing the mo"
},
{
"path": "nnef-pyproject/pyproject.toml",
"chars": 1074,
"preview": "[project]\nname = \"nnef\"\nversion = \"1.0.10\"\ndescription = \"A package for parsing NNEF files\"\nrequires-python = \">=3.7\"\n\nc"
},
{
"path": "nnef-pyproject/setup.py",
"chars": 995,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/stdlib.nnef",
"chars": 19823,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef-pyproject/tests/test.py",
"chars": 4565,
"preview": "# Copyright (c) 2017 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/LICENSE",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "nnef_tools-pyproject/README.md",
"chars": 1178,
"preview": "# NNEF Tools\n\nThis package contains a set of tools for converting and transforming machine learning models.\n\n## Dependen"
},
{
"path": "nnef_tools-pyproject/custom/composite_export_example.py",
"chars": 1376,
"preview": "import numpy as np\nimport src.nnef_tools.io.tf.graphdef as graphdef\ntry:\n import tensorflow.compat.v1 as tf\n tf.di"
},
{
"path": "nnef_tools-pyproject/custom/custom_operators_example.py",
"chars": 422,
"preview": "import torch\n\n\n# define how the PyTorch interpreter should execute the op\n\ndef shuffle(input, groups):\n shape = list("
},
{
"path": "nnef_tools-pyproject/custom/custom_optimizers_example.py",
"chars": 1381,
"preview": "# Define how a sequence of ops is replaced by a new sequence.\n# First test if the sequence of ops matched should be real"
},
{
"path": "nnef_tools-pyproject/custom/custom_transforms_example.py",
"chars": 1088,
"preview": "from src.nnef_tools import Transform\n\n\n# define mapping from custom op names to converter transforms that maps them in t"
},
{
"path": "nnef_tools-pyproject/custom/onnx_custom_export_example.py",
"chars": 1828,
"preview": "import torch\nimport torch.nn.functional as F\nfrom torch.onnx import register_custom_op_symbolic\n\n\ndef aim_affine_grid(g,"
},
{
"path": "nnef_tools-pyproject/custom/onnx_custom_transforms_example.py",
"chars": 1344,
"preview": "from src.nnef_tools import Transform\n\n\ndef affine_grid_shape(theta, shape):\n return shape\n\n\nCUSTOM_SHAPES = {\n 'gr"
},
{
"path": "nnef_tools-pyproject/nnef_tools/__init__.py",
"chars": 590,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/__init__.py",
"chars": 651,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/converter.py",
"chars": 30371,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/nnef_to_onnx.py",
"chars": 19224,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/nnef_to_tf.py",
"chars": 30916,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/nnef_to_tflite.py",
"chars": 19537,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/onnx_to_nnef.py",
"chars": 33581,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/tf_to_nnef.py",
"chars": 28887,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/conversion/tflite_to_nnef.py",
"chars": 15310,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/convert.py",
"chars": 19074,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execute.py",
"chars": 21923,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/__init__.py",
"chars": 595,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/__init__.py",
"chars": 595,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/__init__.py",
"chars": 595,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relax/__init__.py",
"chars": 893,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relax/nnef_frontend.py",
"chars": 11159,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relax/nnef_ops.py",
"chars": 54890,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relay/__init__.py",
"chars": 982,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relay/from_nnef.py",
"chars": 11846,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/execution/tvm/nnef_frontend/relay/nnef_ops.py",
"chars": 48187,
"preview": "# Copyright (c) 2017-2025 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
},
{
"path": "nnef_tools-pyproject/nnef_tools/generate.py",
"chars": 4119,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/gmac.py",
"chars": 5392,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/image_tensor.py",
"chars": 4428,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/interpreter/__init__.py",
"chars": 1418,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/interpreter/pytorch/__init__.py",
"chars": 3894,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/interpreter/pytorch/nnef_module.py",
"chars": 10293,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/interpreter/pytorch/nnef_operators.py",
"chars": 48552,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/__init__.py",
"chars": 590,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/__init__.py",
"chars": 645,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/caffe/__init__.py",
"chars": 590,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/caffe/proto/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/caffe/proto/caffe.proto",
"chars": 59654,
"preview": "syntax = \"proto2\";\n\npackage caffe;\n\n// Specifies the shape (dimensions) of a Blob.\nmessage BlobShape {\n repeated int64 "
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/caffe/proto/caffe_pb2.py",
"chars": 300037,
"preview": "# -*- coding: utf-8 -*-\n# Generated by the protocol buffer compiler. DO NOT EDIT!\n# source: caffe.proto\n\nfrom google.pr"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/reader.py",
"chars": 8895,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/caffe2/writer.py",
"chars": 2077,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/nnef/__init__.py",
"chars": 645,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/nnef/helpers.py",
"chars": 1212,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/nnef/reader.py",
"chars": 5070,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/nnef/writer.py",
"chars": 10808,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/onnx/__init__.py",
"chars": 645,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/onnx/reader.py",
"chars": 13053,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/onnx/writer.py",
"chars": 7926,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/__init__.py",
"chars": 590,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/__init__.py",
"chars": 2379,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/composite.py",
"chars": 6160,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/protobuf.py",
"chars": 960,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/reader.py",
"chars": 8180,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/utils.py",
"chars": 11087,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/graphdef/writer.py",
"chars": 5955,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/__init__.py",
"chars": 683,
"preview": "# Copyright (c) 2020 The Khronos Group Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ma"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AbsOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ActivationFunctionType.py",
"chars": 221,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass ActivationFunctionType("
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AddNOptions.py",
"chars": 870,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/AddOptions.py",
"chars": 1255,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ArgMaxOptions.py",
"chars": 1230,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ArgMinOptions.py",
"chars": 1230,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BatchMatMulOptions.py",
"chars": 1603,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BatchToSpaceNDOptions.py",
"chars": 940,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BidirectionalSequenceLSTMOptions.py",
"chars": 3469,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BidirectionalSequenceRNNOptions.py",
"chars": 2681,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Buffer.py",
"chars": 1955,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BuiltinOperator.py",
"chars": 2595,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass BuiltinOperator(object)"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/BuiltinOptions.py",
"chars": 2745,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass BuiltinOptions(object):"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CallOptions.py",
"chars": 1208,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CastOptions.py",
"chars": 1558,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CombinerType.py",
"chars": 159,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass CombinerType(object):\n "
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ConcatEmbeddingsOptions.py",
"chars": 4042,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ConcatenationOptions.py",
"chars": 1683,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Conv2DOptions.py",
"chars": 3027,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CosOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CustomOptionsFormat.py",
"chars": 147,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass CustomOptionsFormat(obj"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/CustomQuantization.py",
"chars": 2127,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DensifyOptions.py",
"chars": 891,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DepthToSpaceOptions.py",
"chars": 1282,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DepthwiseConv2DOptions.py",
"chars": 3585,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DequantizeOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DimensionMetadata.py",
"chars": 3341,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DimensionType.py",
"chars": 154,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass DimensionType(object):\n"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/DivOptions.py",
"chars": 1255,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/EmbeddingLookupSparseOptions.py",
"chars": 1357,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/EqualOptions.py",
"chars": 877,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ExpOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/ExpandDimsOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FakeQuantOptions.py",
"chars": 2282,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FillOptions.py",
"chars": 870,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FloorDivOptions.py",
"chars": 898,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FloorModOptions.py",
"chars": 898,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FullyConnectedOptions.py",
"chars": 2533,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/FullyConnectedOptionsWeightsFormat.py",
"chars": 183,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass FullyConnectedOptionsWe"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GatherNdOptions.py",
"chars": 898,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GatherOptions.py",
"chars": 1208,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GreaterEqualOptions.py",
"chars": 926,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/GreaterOptions.py",
"chars": 891,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/HardSwishOptions.py",
"chars": 905,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/IfOptions.py",
"chars": 1592,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Int32Vector.py",
"chars": 2036,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/L2NormOptions.py",
"chars": 1282,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSHProjectionOptions.py",
"chars": 1269,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSHProjectionType.py",
"chars": 170,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass LSHProjectionType(objec"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSTMKernelType.py",
"chars": 149,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass LSTMKernelType(object):"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LSTMOptions.py",
"chars": 2704,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LeakyReluOptions.py",
"chars": 1247,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LessEqualOptions.py",
"chars": 905,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LessOptions.py",
"chars": 870,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LocalResponseNormalizationOptions.py",
"chars": 2517,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogSoftmaxOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalAndOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalNotOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/LogicalOrOptions.py",
"chars": 905,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MatrixDiagOptions.py",
"chars": 912,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MatrixSetDiagOptions.py",
"chars": 933,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MaximumMinimumOptions.py",
"chars": 940,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Metadata.py",
"chars": 1515,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MirrorPadMode.py",
"chars": 155,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass MirrorPadMode(object):\n"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MirrorPadOptions.py",
"chars": 1233,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Model.py",
"chars": 6836,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/MulOptions.py",
"chars": 1255,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NegOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NonMaxSuppressionV4Options.py",
"chars": 975,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NonMaxSuppressionV5Options.py",
"chars": 975,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/NotEqualOptions.py",
"chars": 898,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/OneHotOptions.py",
"chars": 1208,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Operator.py",
"chars": 8410,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/OperatorCode.py",
"chars": 1933,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PackOptions.py",
"chars": 1538,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PadOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PadV2Options.py",
"chars": 877,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Padding.py",
"chars": 142,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass Padding(object):\n SA"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/Pool2DOptions.py",
"chars": 2999,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/PowOptions.py",
"chars": 863,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizationDetails.py",
"chars": 167,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nclass QuantizationDetails(obj"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizationParameters.py",
"chars": 7104,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/QuantizeOptions.py",
"chars": 898,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/RNNOptions.py",
"chars": 1661,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
},
{
"path": "nnef_tools-pyproject/nnef_tools/io/tf/lite/flatbuffers/RangeOptions.py",
"chars": 877,
"preview": "# automatically generated by the FlatBuffers compiler, do not modify\n\n# namespace: tflite\n\nimport flatbuffers\nfrom flatb"
}
]
// ... and 69 more files (download for full content)
About this extraction
This page contains the full source code of the KhronosGroup/NNEF-Tools GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 269 files (1.9 MB), approximately 508.2k tokens, and a symbol index with 2995 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.