Onnx2tf

Latest version: v1.26.3

Safety actively analyzes 688323 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 21 of 85

1.16.5

- `Pad`
- Negative padding supported.
- Force substitution to `StridedSlice` since the TensorFlow runtime does not support padding of negative numbers.
- [d3net_dnn_double_44.onnx.zip](https://github.com/PINTO0309/onnx2tf/files/12505175/d3net_dnn_double_44.onnx.zip)
- onnx
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/d6f04e91-27aa-44ec-989c-c46cb8589f1e)
- tflite
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/f61890b9-b3bd-47d1-b204-a590be5af765)
- results
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/075ba41b-e854-43bc-84fd-c91ad5e8630d)
- [[D3Net] Clarification regarding a specific input dimension type 473](https://github.com/PINTO0309/onnx2tf/issues/473)

What's Changed
* Negative padding supported by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/474


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.16.4...1.16.5

1.16.4

- `onnx2tf.py`, `common_functions.py`
- Significantly improved conversion stability by reducing the frequency of SWAPs due to lack of RAM for large models.
- Change the maximum number of recursions in Python to the maximum number of recursions. For Python to abort when the model structure is too large.
python
sys.setrecursionlimit(2147483647) C int maximum

- `InstanceNormalization`
- Workaround for inconsistent `C` position.
- Improved processing stability of `InstanceNormalization`.
- `Stable Diffusion v1.5`
- https://s3.ap-northeast-2.wasabisys.com/temp-models/onnx2tf_430/stable_diffusion_v1.5.tar.gz
- [[Stable Diffusion] Conversion error with stable diffusion model. 424](https://github.com/PINTO0309/onnx2tf/issues/424)
- [[TODO] Switch to a mode that performs inference in slow delay shape estimation mode during very large size transformations such as diffusion models 430](https://github.com/PINTO0309/onnx2tf/issues/430)

What's Changed
* Significantly improved conversion stability by reducing the frequency of SWAPs due to lack of RAM for large models, and improved processing stability of `InstanceNormalization`. by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/472


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.16.3...1.16.4

1.16.3

- `Mul`, `Div`
- Prevents `Mul` -> `Div` patterns from creating redundant `Mul` -> `Mul` operation sets.
- This optimization improves the overall computational efficiency of the model just a little bit.
|onnx|tflite|
|:-:|:-:|
|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/500c4c05-b36a-4db3-a2b0-7ecfd127e930)|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/a9c2b4a7-83a9-4c6b-b559-8a48b085d101)|
- [[Demucs] Issue while converting demucs model from onnx to tflite in conv2d_transpose 470](https://github.com/PINTO0309/onnx2tf/issues/470)

What's Changed
* [experimental] Prevents `Mul` -> `Div` patterns from creating redundant `Mul` -> `Mul` operation sets. by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/471


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.16.2...1.16.3

1.16.2

- `PReLU`
- `slope` conversion bug fixed again
- onnx==1.13.1 -> onnx==1.14.0
- onnxruntime==1.15.0 -> onnxruntime==1.15.1

What's Changed
* PReLU slope conversion bug fixed again by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/468


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.16.1...1.16.2

1.16.1

- `PReLU`
- Fixed `slope` conversion bug.
- [face_landmarks_detector_facemeshv2_1x3x256x256.onnx.zip](https://github.com/PINTO0309/onnx2tf/files/12455913/face_landmarks_detector_facemeshv2_1x3x256x256.onnx.zip)
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/c02d35c6-e7f3-4ef5-9c59-36469f65f85d)

What's Changed
* Fixed PReLU slope conversion bug by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/467


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.16.0...1.16.1

1.16.0

- `GeLU`
- Add logic to replace a set of primitive OPs with `GeLU`s to improve overall model processing efficiency.
https://www.tensorflow.org/api_docs/python/tf/keras/activations/gelu
https://www.tensorflow.org/api_docs/python/tf/nn/gelu
- Automatically detect the range where the following OP combination is valid and replace it with the `GeLU` OP.
- Add `--rtpo`, `--replace_to_pseudo_operators` options with `GeLU`.
- If `-rtpo`, `--replace_to_pseudo_operators` option is set to `GeLU`, the internal processing of `GeLU` is replaced by an `approximate` calculation, speeding up the operation in exchange for a small loss of accuracy.
- `GeLU` by itself can infer 28 times faster than before.
[gelu_11_float32_primitive.tflite.zip](https://github.com/PINTO0309/onnx2tf/files/12466479/gelu_11_float32_primitive.tflite.zip)
[gelu_11_float32_approximate_false.tflite.zip](https://github.com/PINTO0309/onnx2tf/files/12466481/gelu_11_float32_approximate_false.tflite.zip)
[gelu_11_float32_approximate_true.tflite.zip](https://github.com/PINTO0309/onnx2tf/files/12466482/gelu_11_float32_approximate_true.tflite.zip)
python
import tensorflow as tf
import numpy as np
np.random.seed(0)
import time

data = np.random.randn(1,512,512,3).astype(np.float32)
loop = 10

interpreter = tf.lite.Interpreter(
model_path="gelu_11_float32_primitive.tflite",
num_threads=20
)
tf_lite_model = interpreter.get_signature_runner()
inputs = {
'input': data,
}
warmup
_ = tf_lite_model(**inputs)
test
total = 0.0
for i in range(loop):
start_time = time.perf_counter()
_ = tf_lite_model(**inputs)
elapsed_time = time.perf_counter() - start_time
total += elapsed_time
print(f"[TFLite] Primitive inf time: {total / loop}")

interpreter = tf.lite.Interpreter(
model_path="gelu_11_float32_approximate_false.tflite",
num_threads=20
)
tf_lite_model = interpreter.get_signature_runner()
inputs = {
'input': data,
}
warmup
_ = tf_lite_model(**inputs)
test
total = 0.0
for i in range(loop):
start_time = time.perf_counter()
_ = tf_lite_model(**inputs)
elapsed_time = time.perf_counter() - start_time
total += elapsed_time
print(f"[TFLite] Disable approximate inf time: {total / loop}")

interpreter = tf.lite.Interpreter(
model_path="gelu_11_float32_approximate_true.tflite",
num_threads=20
)
tf_lite_model = interpreter.get_signature_runner()
inputs = {
'input': data,
}
warmup
_ = tf_lite_model(**inputs)
test
total = 0.0
for i in range(loop):
start_time = time.perf_counter()
_ = tf_lite_model(**inputs)
elapsed_time = time.perf_counter() - start_time
total += elapsed_time
print(f"[TFLite] Enable approximate inf time: {total / loop}")

![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/79d7fe8e-7b54-4952-b785-46d3f129aba0)
- Results
[gelu.onnx.zip](https://github.com/PINTO0309/onnx2tf/files/12450575/gelu.onnx.zip)
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/755cf787-9150-4572-a458-88354ac295f9)

|onnx|tflite|
|:-:|:-:|
|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/9b2f7a0d-ff76-4e7f-a7e9-60e87cce26b8)|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/0944f075-6b0c-462a-a5cb-fe0c986f6f8d)|
- [[TODO] Implemented forced replacement of GeLU processing with standard OP. 465](https://github.com/PINTO0309/onnx2tf/issues/465)

What's Changed
* Add logic to replace a set of primitive OPs with `GeLU`s to improve overall model processing efficiency by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/466


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.15.18...1.16.0

Page 21 of 85

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.