def test_tf_multiple_lstm_block_fused_cell(self, compute_unit, backend):
        '''
        Define a network with a stack of fused LSTM ops:

        %input (shape: (Seq, Batch, idim) == (5, 2, 4))
        %x1 = LSTM(h=10) (%input) # shape = (5, 2, 10)
        %x2 = LSTM(h=20) (%x1) # shape = (5, 2, 20)
        %x3 = slice()(%x2) # shape = (1, 2, 20), to get the final seq value
        %x4 = reshape((1, -1)) (%x3) # shape = (1, 40)
        %x5 = Dense(h=3)(%x4) # shape = (1, 3)
        '''
        input_dim = 4
        seq_length = 5
        batch_size = 2
        x_shape = (seq_length, batch_size, input_dim)

        with tf.Graph().as_default() as graph:
            x = tf.placeholder(tf.float32, shape=x_shape) # shape = (5, 2, 4)

            lstm_cell_1 = tf.contrib.rnn.LSTMBlockFusedCell(num_units=10)
            x1, _ = lstm_cell_1(x, dtype=tf.float32) # shape = (5, 2, 10)
            lstm_cell_2 = tf.contrib.rnn.LSTMBlockFusedCell(num_units=20)
            x2 , _ = lstm_cell_2(x1, dtype=tf.float32) # shape = (5, 2, 20)
            x3 = tf.slice(x2, begin=[4, 0, 0], size=[1, 2, 20]) # shape = [1, 2, 20]
            x4 = tf.reshape(x3, shape=(1, -1)) # shape = [1, 40]
            x5 = tf.linalg.matmul(x4, tf.constant(np.arange(1, 40*3, dtype=np.float32), shape=[40, 3])) # shape: [1, 3]

            res = TensorFlowBaseTest.run_compare_tf(
                graph,
                {x: np.random.rand(*x_shape).astype(np.float32),},
                x5,
                compute_unit=compute_unit,
                backend=backend,
                # variable needs to be frozen
                freeze_graph=True,
            )

            # check that the resulting program has the LSTM block ops as fused ops
            coreml_model = res[1]
            mil_prog = coreml_model._get_mil_internal()
            assert len(mil_prog.find_ops(op_type="lstm")) == 2

        Define a network with a stack of fused LSTM ops:

        %input (shape: (Seq, Batch, idim) == (5, 2, 4))
        %x1 = LSTM(h=10) (%input) # shape = (5, 2, 10)
        %x2 = LSTM(h=20) (%x1) # shape = (5, 2, 20)
        %x3 = slice()(%x2) # shape = (1, 2, 20), to get the final seq value
        %x4 = reshape((1, -1)) (%x3) # shape = (1, 40)
        %x5 = Dense(h=3)(%x4) # shape = (1, 3)
        
coremltools/converters/mil/frontend/tensorflow/test/test_ops.py