Skip to content

Support for ragged range operator #1254

@buddhapuneeth

Description

@buddhapuneeth

Describe the bug
I am not able to convert TF model with ragged.range operator.

Urgency
We are experimenting few approaches for our usecase. One of the way is using ragged range operator. This approach is working fine in TF. We would like to see can it be support with minimal changes on tf2onnx

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS Catalina 10.15.7
  • Tensorflow Version: 2.0
  • Python version: 3.6

To Reproduce
sample code used:

import tensorflow as tf
import numpy as np
ip = np.array([3,5,2])
x = tf.placeholder(tf.float32, ip.shape, name="input")
d = tf.ragged.range(x, name="output",row_splits_dtype=tf.dtypes.int32)
sess = tf.Session()
feed_dict = {"input:0": ip}
output = sess.run(sess.graph.get_tensor_by_name("output:0"), feed_dict=feed_dict);
print(output)
sess.close()

rr_test2.txt

You can convert the type to .pb from .txt (I modified to upload here)

Command
python -m tf2onnx.convert --input rr_test2.pb --inputs input:0 --output rr_test2.onnx --outputs output:0 --opset 11 --fold_const

Error

Value "<dtype: 'int32'>" is not valid attribute data type.
2020-12-31 09:23:49,363 - ERROR - pass1 convert failed for name: "output"
op: "RaggedRange"
input: "output/Cast"
input: "input"
input: "output/Cast_1"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "Tsplits"
  value {
    type: DT_INT32
  }
}
, ex=Not a cmessage

Expected behavior
Able to convert to ONNX

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions