Skip to content

Remove Gelu Fusion for TF Newapi #1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
from neural_compressor.tensorflow.quantization.utils.graph_rewriter.graph_base import GraphRewriterBase
from neural_compressor.tensorflow.quantization.utils.graph_util import GraphAnalyzer
from neural_compressor.tensorflow.quantization.utils.graph_util import GraphRewriterHelper as Helper
from neural_compressor.tensorflow.utils import SPR_BASE_VERSIONS


class FuseGeluOptimizer(GraphRewriterBase): # pragma: no cover
"""Fuse Sqrt + RealDiv + Erf + AddV2 + Mul + Mul into Gelu op."""

def do_transformation(self):
"""Execute the fusion from small ops to Gelu."""
if not (tf.version.VERSION in ("1.15.0-up2", "1.15.0-up3") or tf.version.VERSION in SPR_BASE_VERSIONS):
if tf.version.VERSION not in ("1.15.0-up2", "1.15.0-up3"):
return self.model

cur_graph = GraphAnalyzer()
Expand Down
Loading
Loading