import tensorflow as tf


    if layout != 'NCHW':
        need_transpose = False

    in_shapes = []
    for layer in keras_model._input_layers:
        if tf.executing_eagerly():
            in_shapes.append(tuple(dim if dim is not None else 1 for dim in layer.input.shape))
        else:
            in_shapes.append(tuple(dim.value if dim.value is not None else 1 for dim in layer.input.shape))


