(model, input_shapes: TensorShapes)
return inputs
Only generate rand inputs whose shape in `input_shapes`
Only generate rand inputs whose shape in `input_shapes`
Only generate rand inputs whose shape in input_shapes
def generate_specific_rand_input(model, input_shapes: TensorShapes):
    """
    Only generate rand inputs whose shape in `input_shapes`
    """

    for key, shape in input_shapes.items():
        if not np.all(np.array(shape) > 0):
            raise RuntimeError(
                'The shape of input "{}" has dynamic size "{}", '
                'please determine the input size manually by '
                '"--dynamic-input-shape --input-shape xxx" or "--input-shape xxx". '
                'Run "python3 -m onnxsim -h" for details'.format(key, shape))

    inputs = {ipt: np.array(np.random.rand(*input_shapes[ipt]),
                            dtype=get_np_type_from_elem_type(get_elem_type(model, ipt))) for ipt in
              input_shapes}
    return inputs
def generate_specific_rand_input ( model , input_shapes : TensorShapes ) : for key , shape in input_shapes . items ( ) : if not np . all ( np . array ( shape ) > 0 ) : raise RuntimeError ( 'The shape of input "{}" has dynamic size "{}", ' 'please determine the input size manually by ' '"--dynamic-input-shape --input-shape xxx" or "--input-shape xxx". ' 'Run "python3 -m onnxsim -h" for details' . format ( key , shape ) ) inputs = { ipt : np . array ( np . random . rand ( * input_shapes [ ipt ] ) , dtype = get_np_type_from_elem_type ( get_elem_type ( model , ipt ) ) ) for ipt in input_shapes } return inputs