human
I wrote the below code

    inputs = tf.constant(feature_map['inputs'])
    input_is_image = (False if (len(inputs.shape) < 3) else True)
    def input_fn(problem_choice, x=inputs):
        p_hparams = hparams.problems[problem_choice]
        if (not input_is_image):
            num_samples = x[0]
            length = x[2]
            x = tf.slice(x, [3], tf.to_int32([length]))
            x = tf.reshape(x, [1, (-1), 1, 1])
            x = tf.tile(x, tf.to_int32([num_samples, 1, 1, 1]))
        else:
            x = tf.image.resize_images(x, [299, 299])
            x = tf.reshape(x, [1, 299, 299, (-1)])
            x = tf.to_int32(x)
        return (tf.constant(p_hparams.input_space_id), tf.constant(p_hparams.target_space_id), x)
    (input_space_id, target_space_id, x) = input_fn_builder.cond_on_index(input_fn, feature_map['problem_choice'], 0, (len(hparams.problems) - 1))
    features = {}
    features['problem_choice'] = tf.constant(feature_map['problem_choice'])
    features['input_space_id'] = input_space_id
    features['target_space_id'] = target_space_id
    features['decode_length'] = (IMAGE_DECODE_LENGTH if input_is_image else inputs[1])
    features['inputs'] = x
    return features

What's a good function header?
assistant
#Here's a good function header.

def _interactive_input_tensor_to_features_dict(feature_map, hparams):