Onnx2tf

Latest version: v1.27.1

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

Scan your dependencies

Page 23 of 86

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

1.15.18

- `common_functions.py`
- Bug fix for `shape_unmatched_special_avoidance_workaround`.
- Fixed a problem in which expected transposition behavior was not performed under very limited conditions.
- Fixed a problem in which the overall model structure was so broken due to transposition errors that when an accuracy check was performed, an inefficient and large np.ndarray was generated to the extent that RAM swapping occurred.
- https://github.com/jinyeying/nighttime_dehaze

What's Changed
* Bug fix for `shape_unmatched_special_avoidance_workaround` by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/464


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

1.15.17

- `common_functions.py`
- Experimental implementation.
- To avoid generating unnecessary `Reshape` as much as possible, the process is terminated early when a simple operation of tensor A and tensor B is established.
- [mobilenetv3_large_pytorch.onnx.zip](https://github.com/PINTO0309/onnx2tf/files/12421461/mobilenetv3_large_pytorch.onnx.zip)
|Before|After|
|:-:|:-:|
|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/00338f6c-39d6-4c7e-8ca7-001e7aa896fc)|![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/7e54e7b4-dfe9-4eb9-892b-9fc53e83bbfe)|
- `PRelu`
- Review processing of `pre_explicit_broadcast` and `explicit_broadcast`.

What's Changed
* [experimental] To avoid generating unnecessary `Reshape` as much as possible, the process is terminated early when a simple operation of tensor A and tensor B is established. by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/463


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.15.16...1.15.17

1.15.16

- `common_functions.py`
- Improved shape correction process.
- Consider patterns where axis broadcasts occur.
- Further improves the stability of the overall model transformation.
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/750acb01-324d-4b4a-82b9-8630fda84de4)
![image](https://github.com/PINTO0309/onnx2tf/assets/33194443/c334170c-f466-41fc-bd67-613f2bec2020)
- [[DNN-based_source_separation] Facing issue in Mul node during conversion 460](https://github.com/PINTO0309/onnx2tf/issues/460)

What's Changed
* Improved shape correction process by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/462


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.15.15...1.15.16

Page 23 of 86

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.