There was a mega thread at:

  

      github.com/tensorflow/tensorflow
  

  
    
  
	  
  

  
    
      Need tf.signal.rfft op in TFLite 2
    

    
      
        opened 
        
          
        
        Mar 30, 2019
      
      


      
        
          
          jpangburn
        
      
    

    
        comp:lite
        comp:signal
        type:feature
    
  


  
    **System information**
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04…): macOS 10.14.4
- TensorFlow installed from (source or binary): binary
- TensorFlow version (or github SHA if from source): 1.13.1


**Provide the text output from tflite_convert**
If I pass the SELECT_TF_OPS option then I get:

```
Some of the operators in the model are not supported by the standard TensorFlow Lite runtime and are not recognized by TensorFlow. If you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.lite.TFLiteConverter(). Here is a list of builtin operators you are using: ADD, CAST, CONCATENATION, DIV, EXPAND_DIMS, FLOOR_DIV, FULLY_CONNECTED, GATHER, LOG, MAXIMUM, MINIMUM, MUL, PACK, PAD, RANGE, RESHAPE, SHAPE, SPLIT, SPLIT_V, STRIDED_SLICE, SUB, TRANSPOSE. Here is a list of operators for which you will need custom implementations: RFFT.
```
If I don't pass the SELECT_TF_OPS option then I get:
```
Some of the operators in the model are not supported by the standard TensorFlow Lite runtime. If those are native TensorFlow operators, you might be able to use the extended runtime by passing --enable_select_tf_ops, or by setting target_ops=TFLITE_BUILTINS,SELECT_TF_OPS when calling tf.lite.TFLiteConverter(). Otherwise, if you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.lite.TFLiteConverter(). Here is a list of builtin operators you are using: ADD, CAST, CONCATENATION, DIV, EXPAND_DIMS, FLOOR_DIV, FULLY_CONNECTED, GATHER, LOG, MAXIMUM, MINIMUM, MUL, PACK, PAD, RANGE, RESHAPE, SHAPE, SPLIT, SPLIT_V, STRIDED_SLICE, SUB, TRANSPOSE. Here is a list of operators for which you will need custom implementations: ComplexAbs, Cos, LinSpace, RFFT.
```

Also, please include a link to a GraphDef or the model if possible.
The code to create the model is pretty short since I hardcoded a bunch of parameters for now:

    with tf.Graph().as_default(), tf.Session() as sess:
        # input sound data as a waveform
        waveform = tf.placeholder(tf.float32, [None])
        # A Tensor of [batch_size, num_samples] mono PCM samples in the range [-1, 1].
        pcm = tf.math.scalar_mul(1/32768.0, waveform)

        # compute Short Time Fourier Transform
        stft = tf.signal.stft(pcm, frame_length=400, frame_step=160, fft_length=512)
        spectrogram = tf.abs(stft)

        # Warp the linear scale spectrograms into the mel-scale.
        num_spectrogram_bins = stfts.shape[-1].value
        lower_edge_hertz, upper_edge_hertz, num_mel_bins = 125.0, 7500.0, 64
        linear_to_mel_weight_matrix = tf.signal.linear_to_mel_weight_matrix(
          num_mel_bins, num_spectrogram_bins, sample_rate, lower_edge_hertz,
          upper_edge_hertz)
        mel_spectrogram = tf.tensordot(
          spectrogram, linear_to_mel_weight_matrix, 1)
        mel_spectrogram.set_shape(spectrogram.shape[:-1].concatenate(
          linear_to_mel_weight_matrix.shape[-1:]))

        # Compute a stabilized log to get log-magnitude mel-scale spectrograms.
        log_mel_spectrogram = tf.log(mel_spectrogram + 1e-6)
        # with the model loaded and input/output tensors defined, convert to tf.lite
        converter = tf.lite.TFLiteConverter.from_session(sess, [waveform], [log_mel_spectrogram])
        converter.target_ops = [tf.lite.OpsSet.SELECT_TF_OPS, tf.lite.OpsSet.TFLITE_BUILTINS]
        tflite_model = converter.convert()

**Any other info / logs**
Assuming the SELECT_TF_OPS option produces a model that will work on TFLite on iOS, then I guess all I need is RFFT.  Thank you!
  

  

  
    
    
  

  


At the end It seems that there Is a workaround.