tf.compat.v1.estimator.inputs.numpy_input_fn

View source on GitHub

Returns input function that would feed dict of numpy arrays into the model.

tf.compat.v1.estimator.inputs.numpy_input_fn(
    x, y=None, batch_size=128, num_epochs=1, shuffle=None, queue_capacity=1000,
    num_threads=1
)

This returns a function outputting features and targets based on the dict of numpy arrays. The dict features has the same keys as the x. The dict targets has the same keys as the y if y is a dict.

Example:

age = np.arange(4) * 1.0
height = np.arange(32, 36)
x = {'age': age, 'height': height}
y = np.arange(-32, -28)

with tf.Session() as session:
  input_fn = numpy_io.numpy_input_fn(
      x, y, batch_size=2, shuffle=False, num_epochs=1)

Args:

Returns:

Function, that has signature of ()->(dict of features, targets)

Raises: