<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def circuit_to_tensorflow_runnable( circuit: circuits.Circuit, initial_state: Union[int, np.ndarray] = 0, ) -> ComputeFuncAndFeedDict: """Returns a compute function and feed_dict for a `cirq.Circuit`'s output. `result.compute()` will return a `tensorflow.Tensor` with `tensorflow.placeholder` objects to be filled in by `result.feed_dict`, at which point it will evaluate to the output state vector of the circuit. You can apply further operations to the tensor returned by `result.compute`. This allows, for example, for the final result to be a small amount of computed data (e.g. an expectation value) instead of the gigantic raw state vector. The tensor returned by `result.compute` is intended to run efficiently on cloud TPUs. It will have dtype complex64 and a shape of (2**n,) where n is the number of qubits. Examples: To simulate the circuit with tensorflow in a normal session, forward this method's output into `tensorflow.Session.run` as follows: import tensorflow as tf with tf.Session() as session: output = session.run(r.compute(), feed_dict=r.feed_dict) print(output) Note that you can use the returned tensor in further computations. For example, to compute the chance of the system ending up in the first 128 computational basis states you can use `tf.norm(tensor[:128], 2)`: import tensorflow as tf expectation = lambda: tf.norm(r.compute()[:128], 2) with tf.Session() as session: output = session.run(expectation, feed_dict=r.feed_dict) print(output) For documentation on running against cloud TPUs, see https://cloud.google.com/tpu/docs/quickstart#run_example Generally speaking, from within a cloud instance, you use `tf.contrib.tpu.rewrite` to convert the tensor into a TPU compatible form, initialize the TPU system, then run the rewritten tensor: import tensorflow as tf TPU_TARGET = ??????? rewritten_for_tpu = tf.contrib.tpu.rewrite(r.compute) with tf.Session(target=TPU_TARGET) as session: session.run(tf.contrib.tpu.initialize_system()) output = session.run(rewritten_for_tpu, feed_dict=r.feed_dict) print(output) Args: circuit: The circuit to apply to `initial_state` to produce an output state vector. initial_state: The input into the circuit. If this is an integer, it indicates that the input state is a computational basis state where the k'th qubit is set by the k'th bit of the integer. If this is a numpy array, it should directly encode a normalized wavefunction. Returns: A ComputeFuncAndFeedDict, which is a named tuple whose first element is a function that returns a Tensor representing the output state vector that results from applying the given circuit to the given, and whose second element is a feed_dict containing important parameters describing that tensor. """

    if not circuit.are_all_measurements_terminal():
        raise ValueError('not circuit.are_all_measurements_terminal()')

    t = _TensorCircuit(circuit, initial_state)
    return ComputeFuncAndFeedDict(t.compute, t.feed_dict)