parameters: (input_nodes, input_shapes, input_dtypes)
return_statement: return random_input_fn
docstring: Generate random input_fn
docstring_summary: Generate random input_fn
docstring_tokens: Generate random input_fn
function: def gen_random_input_fn(input_nodes, input_shapes, input_dtypes):
    """Generate random input_fn"""
  
    def random_input_fn(iter):
      feed_dict = dict()
      for input_node, input_shape, input_dtype in zip(input_nodes, input_shapes,
                                                      input_dtypes):
        in_shape = input_shape.copy()
        if input_shape[0] is None or input_shape[0] == -1:
          in_shape[0] = 1
  
        dtype_range = {
            np.bool_: (False, True),
            np.bool8: (False, True),
            np.uint8: (0, 255),
            np.uint16: (0, 65535),
            np.int8: (-128, 127),
            np.int16: (-32768, 32767),
            np.int64: (-2**63, 2**63 - 1),
            np.uint64: (0, 2**64 - 1),
            np.int32: (-2**31, 2**31 - 1),
            np.uint32: (0, 2**32 - 1),
            np.float32: (-1, 1),
            np.float64: (-1, 1)
        }
        min_value = dtype_range[np.dtype(input_dtype).type][0]
        max_value = dtype_range[np.dtype(input_dtype).type][1]
        feed_dict[input_node] = np.random.random(in_shape) * (
            max_value - min_value) + min_value
      return feed_dict
  
    return random_input_fn
function_tokens: def gen_random_input_fn ( input_nodes , input_shapes , input_dtypes ) : def random_input_fn ( iter ) : feed_dict = dict ( ) for input_node , input_shape , input_dtype in zip ( input_nodes , input_shapes , input_dtypes ) : in_shape = input_shape . copy ( ) if input_shape [ 0 ] is None or input_shape [ 0 ] == - 1 : in_shape [ 0 ] = 1 dtype_range = { np . bool_ : ( False , True ) , np . bool8 : ( False , True ) , np . uint8 : ( 0 , 255 ) , np . uint16 : ( 0 , 65535 ) , np . int8 : ( - 128 , 127 ) , np . int16 : ( - 32768 , 32767 ) , np . int64 : ( - 2 ** 63 , 2 ** 63 - 1 ) , np . uint64 : ( 0 , 2 ** 64 - 1 ) , np . int32 : ( - 2 ** 31 , 2 ** 31 - 1 ) , np . uint32 : ( 0 , 2 ** 32 - 1 ) , np . float32 : ( - 1 , 1 ) , np . float64 : ( - 1 , 1 ) } min_value = dtype_range [ np . dtype ( input_dtype ) . type ] [ 0 ] max_value = dtype_range [ np . dtype ( input_dtype ) . type ] [ 1 ] feed_dict [ input_node ] = np . random . random ( in_shape ) * ( max_value - min_value ) + min_value return feed_dict return random_input_fn