tf-mlir-translate and flatbuffer_translate failure for the ERF function
Hi @Jerry-Ge, 

I tried both the commands but I'm getting different errors... did you upload the right files?

```
../tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-mlir-translate --graphdef-to-mlir --tf-enable-shape-inference-on-import --tf-output-arrays=result erf_model.pb -o test_tf.preopt.mlir --tf-input-arrays=placeholder_0 --tf-input-shapes=1
2023-06-08 23:20:41.144947: E tensorflow/compiler/mlir/tensorflow/utils/import_utils.cc:48] Error parsing Protobuf
2023-06-08 23:20:41.145026: E tensorflow/compiler/mlir/tensorflow/translate/tf_mlir_translate.cc:129] Graph import failed: INVALID_ARGUMENT: Could not parse input proto
```

```
../tensorflow/bazel-bin/tensorflow/compiler/mlir/lite/flatbuffer_translate --tflite-flatbuffer-to-mlir erf_model.tflite --output-arrays=PartitionedCall:0 -o test_tflite.preopt.mlir
ERROR: The model is not a valid Flatbuffer buffer
erf_model.tflite:0:0: error: couldn't parse flatbuffer
```

alternatively, did I translate your commands incorrectly to my environment? thanks @pkgoogle for helping on this. I cloned the model repo again and still couldn't get those Protobuff/Flatbuffer errors. Also double-checked your command and that looks fine. 

### A few options: 
- Maybe something wrong when you're downloading the model files which is causing some corruptions
- It's a very dummy model and it you can easily generate those by the following definition
```
  @tf.function(input_signature=[tf.TensorSpec(shape=[1, ], dtype=tf.float32)])
  def erf(self, x):
    return tf.math.erf(x)
```

### Some more progress/issues for TF
In the tf model generated, there seems missing a result there and I could get the following errors: 
```
INVALID_ARGUMENT: Output result was not found in graph
```
By running this command: 
```
tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-mlir-translate --graphdef-to-mlir --tf-enable-shape-inference-on-import --tf-output-arrays result erf_model.pb -o test_tf.preopt.mlir --tf-input-arrays placeholder_0 --tf-input-shapes=1
```
If we remove `--tf-output-arrays result` flag, this gonna work and I can see the tf.Erf in the generated ir

### For TFL
the same error as described on the top.  @Jerry-Ge, What branch are you working out of? Master? Nightly? A release branch? > @Jerry-Ge, What branch are you working out of? Master? Nightly? A release branch?

it's an internal mirror branch from master. The lash commit is: 45f08a0fcc90145b9c2b7057310762d6b0ebae85 So I went to the exact same commit and recompiled those binaries

I was able to get the tflite command to work:
```
../tensorflow/bazel-bin/tensorflow/compiler/mlir/lite/flatbuffer_translate --tflite-flatbuffer-to-mlir erf.tflite --output-arrays=PartitionedCall:0 -o test_tflite.preopt.mlir
```
test_tflite.preopt.mlir:
```
module attributes {tf_saved_model.semantics, tfl.description = "MLIR Converted.", tfl.schema_version = 3 : i32} {
  func.func @main(%arg0: tensor<1xf32> {tf_saved_model.index_path = ["x"]}) -> (tensor<1xf32> {tf_saved_model.index_path = ["output_0"]}) attributes {tf.entry_function = {inputs = "serving_defa
ult_x:0", outputs = "PartitionedCall:0"}, tf_saved_model.exported_names = ["serving_default"]} {
    %0 = "tfl.custom"(%arg0) {custom_code = "FlexErf", custom_option = #tfl<const_bytes : "0x03457266001212034572661A002A070A0154120230013200000219151414042801">} : (tensor<1xf32>) -> tensor<1x
f32>
    return %0 : tensor<1xf32>
  }
}
```

I'm still getting the previous error with the "regular" TF version:
```
../tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-mlir-translate --graphdef-to-mlir --tf-enable-shape-inference-on-import --tf-output-arrays=result saved_model.pb -o test_tf.preopt.mlir --tf-input-arrays=placeholder_0 --tf-input-shapes=1
2023-06-09 21:00:13.685096: E tensorflow/compiler/mlir/tensorflow/utils/import_utils.cc:48] Error parsing Protobuf
2023-06-09 21:00:13.685157: E tensorflow/compiler/mlir/tensorflow/translate/tf_mlir_translate.cc:129] Graph import failed: INVALID_ARGUMENT: Could not parse input proto
```

My exact code to produce the .pb and .tflite files:
create_model.py:
```
import tensorflow as tf


class Erfer(tf.Module):
    @tf.function(input_signature=[tf.TensorSpec(shape=[1, ], dtype=tf.float32)])
    def erf(self, x):
        return tf.math.erf(x)


model = Erfer()
tf.saved_model.save(model, 'saved_model')
```
and
convert_model.py:
```
import tensorflow as tf

# Path to the saved model directory
saved_model_dir = 'saved_model'

# Convert the saved model to TFLite format
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
tflite_model = converter.convert()

# Save the TFLite model to a file
tflite_model_file = 'erf.tflite'
with open(tflite_model_file, 'wb') as f:
    f.write(tflite_model)
```

So I believe the flatbuffer to MLIR is expected given that this is a FlexOp i.e. it is not natively built for TFLite (It essentially just makes it work with the original TF implementation)

Is this ticket a feature request to make ERF a "BUILTIN" TFLite Op or to just make ERF "work"? i.e. do you run into any errors when attempting to use the .tflite model? Let me you know if you need any clarity on what I'm asking. # TF 
It's quite weird for TF. my code looks very similar except I'm using something like this
```
model = Model()
concrete_function = model.erf.get_concrete_function()
tf.io.write_graph(concrete_function.graph, ".", "model_file_name", True)
```
# TFL 
For TFLite, I'm requesting to make ERF a "BUILTIN" Op if I understood that correctly. i.e., I want to see the tfl.erf in the mlir file which currently it's a customOp
 Hi @haozha111, would you know if/when ERF will make it into TFLite as a BUILTIN op? Thanks! Hi all, bring this up again and see if there're any updates.  Hi all, bring this up again and see if there're any updates.

 Hi all, bring this up again and see if there're any updates.

 @pkgoogle seems no responses for a long time.  Fixed it. 
### For TF

```
Results INVALID_MLIR test_erf_1_f32: Error 1 running command: /tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-mlir-translate --graphdef-to-mlir --tf-enable-shape-inference-on-import --tf-output-arrays=result erf/test_erf_1_f32/model.pb -o erf/test_erf_1_f32/test_tf.preopt.mlir --tf-input-arrays placeholder_0 --tf-input-shapes 1,
```
You can find the dummy tf erf model here: https://github.com/Jerry-Ge/tfl_models/blob/main/erf_model.pb

### For TFL
After running
```
/tensorflow/compiler/mlir/lite/flatbuffer_translate --tflite-flatbuffer-to-mlir erf/test_erf_1_f32/model.tflite --output-arrays=PartitionedCall:0 -o erf/test_erf_1_f32/test_tflite.preopt.mlir
```
You can find the dummy tfl erf model here: https://github.com/Jerry-Ge/tfl_models/blob/main/erf_model.tflite


It's generating a `tfl.custom` operator here which is not tfl.erf
```
module attributes {tf_saved_model.semantics, tfl.description = "MLIR Converted.", tfl.schema_version = 3 : i32} {
  func.func @main(%arg0: tensor<1xf32> {tf_saved_model.index_path = ["placeholder_0"]}) -> (tensor<1xf32> {tf_saved_model.index_path = ["output_0"]}) attributes {tf.entry_function = {inputs = "serving_default_placeholder_0:0", outputs = "PartitionedCall:0"}, tf_saved_model.exported_names = ["serving_default"]} {
    %0 = "tfl.custom"(%arg0) {custom_code = "FlexErf", custom_option = #tfl<const_bytes : "0x03457266001212034572661A002A070A0154120230013200000219151414042801">} : (tensor<1xf32>) -> tensor<1xf32>
    return %0 : tensor<1xf32>
  }
}
```

I think there requires some fair amount of support to the erf function for mlir. 

Related ticket: https://github.com/tensorflow/tensorflow/issues/60663