import tensorflow as tf

        # TODO: check that all i in indices have ndim n-1 
        # TODO: support broadcasting for numpy arrays with np.broadcast_to()
        #indices = tf.pack(list(indices), axis=len(indices)-1)
        indices = tf.pack(list(indices), axis=-1)
        # indices = tf.Print(indices, [indices], 'indices', summarize=100)
        return tf.gather_nd(t, indices)
    else:
        raise NotImplementedError('index {} with {}'.format(t, indices))


