Sitelet https://web.archive.org/web/20210820195643/https://github.com/onnx/onnx/issues/3451
Skip to content
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

need tf.random.shuffle supported. #3451

Open
chan4cc opened this issue Apr 26, 2021 · 2 comments
Open

need tf.random.shuffle supported. #3451

chan4cc opened this issue Apr 26, 2021 · 2 comments

Comments

@chan4cc
Copy link

@chan4cc chan4cc commented Apr 26, 2021 •

New Operator

Describe the operator

Why is this operator necessary? What does it accomplish?

This is a frequently used operator in tensorflow/keras

Can this operator be constructed using existing onnx operators?

If so, why not add it as a function?

I don't know.

Is this operator used by any model currently? Which one?

Are you willing to contribute it? (Y/N)

N. I am still a novice to onnx and C++.

Notes

Any additional information

I'm trying to convert a keras h5 model(create with tf1.12) to ONNX:

from tensorflow.keras.models import load_model

model = load_model(my_model_file)

onnx_model = keras2onnx.convert_keras(model, model.name)
onnx_model.save_model('model.onnx')

which report a error like:

WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_6 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_5 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_4 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_3 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_2 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle_1 of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
WARN: No corresponding ONNX op matches the tf.op node cos_sim/RandomShuffle of type RandomShuffle
      The generated ONNX model needs run with the custom op supports.
There is an error(<class 'StopIteration'>) happened during optimizing on the converted model!

Thers is a tf.random.shuffle op used in my code. And I tried pass param custom_op_conversions with {'RandomShuffle': tf.random.shuffle}, and it report the same error. it seems that onnx opset not support op tf.random.shuffle yet?

Version Used:
tensorflow: 1.12
onnxconverter-common: 1.8.1
keras2onnx: 1.8.0
onnx: 1.8.1

I've also searched RandomShuffle in file onnx/onnx/defs/operator_sets.h and indeed did not find its existence up to version 14.

@jcwchen
Copy link
Member

@jcwchen jcwchen commented Apr 26, 2021

Hi @chan4cc,
Yes shuffle is not supported yet... I will tag it as an enhancement.

@milind-soni
Copy link

@milind-soni milind-soni commented Aug 20, 2021

Hi @chan4cc,
Yes shuffle is not supported yet... I will tag it as an enhancement.

How do we go about implementing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants