Description
Hi,
I'm using tf2onnx convert a pb model to onnx model with the following instruction:
python3 -m tf2onnx.convert --graphdef logs/model.pb --output logs/model.onnx --inputs xs:0,xlen:0 --outputs Identity:0
But it gives the following error:
The original code like this:
`
@tf.function
def tf_stft(signals, frame_length, frame_step, fft_length=None,
window_fn=tf.signal.hann_window, pad_end=False):
signals = tf.convert_to_tensor(signals)
signals.shape.with_rank_at_least(1)
frame_length = tf.convert_to_tensor(frame_length)
frame_length.shape.assert_has_rank(0)
frame_step = tf.convert_to_tensor(frame_step)
frame_step.shape.assert_has_rank(0)
if fft_length is None:
order = tf.ceil(tf.log(frame_length*1.0)/tf.log(2.))
fft_length = tf.math.pow(2, tf.cast(order, dtype=tf.int32))
else:
fft_length = tf.convert_to_tensor(fft_length)
framed_signals = tf.signal.frame(signals, fft_length,
frame_step, pad_end=pad_end)
if window_fn is not None:
window = window_fn(frame_length, dtype=framed_signals.dtype)
lpad = (fft_length - window.shape[-1]) // 2
window = tf.pad(window, [[0, 0]] * (window.shape.ndims - 1) +
[[lpad, fft_length - window.shape[-1] - lpad]])
framed_signals *= window
return tf.signal.rfft(framed_signals, [fft_length])
`
and I convert it to pb model first, then try to convert the pb model to onnx model failed. But in TensorFlow1.x environment, I use the same code convert it to saved model and then convert the saved model to onnx model, everything is ok. What's wrong? Anyone can give me some help? Thanks a lot. The pb model I put here.