MPolaris / onnx2tflite

Tool for onnx->keras or onnx->tflite. Hope this tool can help you.
Apache License 2.0
526 stars 42 forks source link

clip_by_value=>relu6 #14

Closed duanshengliu closed 1 year ago

duanshengliu commented 2 years ago

Hi,考虑一下把clip_by_value如果最大值是6则改成激活函数relu6感觉会更好些

MPolaris commented 2 years ago

好主意,是一个不错的优化trick,如果你有时间的话可以提交一个PR。

PINTO0309 commented 2 years ago

The following five patterns can be optimized. If this is meddling, please ignore it.

https://github.com/PINTO0309/onnx2tf/blob/98620e50d3d2366b1b544cb1f9987b9cf4d3527b/onnx2tf/ops/Clip.py#L89-L122

MPolaris commented 2 years ago

The following five patterns can be optimized. If this is meddling, please ignore it.

  • ReLU6
  • ReLU
  • Minimum
  • Maximum
  • Minimum + Maximum

https://github.com/PINTO0309/onnx2tf/blob/98620e50d3d2366b1b544cb1f9987b9cf4d3527b/onnx2tf/ops/Clip.py#L89-L122

Thanks for your tricks, I will seriously consider your proposal.