Commit 8cfcc47b authored by Yuxin Wu's avatar Yuxin Wu

update docs

parent 3c14ff66
...@@ -243,30 +243,33 @@ def remap_input_source(input, names): ...@@ -243,30 +243,33 @@ def remap_input_source(input, names):
except that the corresponding ones are replaced with the tensor produced except that the corresponding ones are replaced with the tensor produced
by the given :class:`InputSource`. by the given :class:`InputSource`.
Args:
input(InputSource): a :class:`InputSource`, whose tensors will get mapped.
names(list[str]): list of input names corresponding to the tensors
produced by ``input``.
Returns:
InputSource:
Example: Example:
.. code-block:: python .. code-block:: python
input1 = QueueInput(ds) input1 = QueueInput(ds)
# assume ds produces 'image' and 'label', but the graph takes more # assume ds produces data that should be fed to 'image' and 'label',
# inputs for some reasons, or takes inputs of a different order: # but the graph takes more inputs for some reasons, or takes inputs
input_signature = [tf.TensorSpec((None,10), tf.float32, 'score'), # of a different order, for example like the following:
tf.TensorSpec((None,20,20,3), tf.float32, 'label'),
tf.TensorSpec((None,), tf.int32, 'image') ] # input_signature = [tf.TensorSpec((None,10), tf.float32, 'score'),
# tf.TensorSpec((None,20,20,3), tf.float32, 'label'),
# tf.TensorSpec((None,), tf.int32, 'image') ]
input2 = remap_input_source(input1, ['image', 'label']) input2 = remap_input_source(input1, ['image', 'label'])
input2.setup(input_signature) # now, if input2 is used with the above input_signature, it will return a
# now, input2.get_input_tensors() will return a placeholder for 'score', # placeholder for 'score', plus the tensors returned by input1
# plus the tensors returned by input1.get_input_tensors()
""" """
def __init__(self, input, names): def __init__(self, input, names):
"""
Args:
input(InputSource): a :class:`InputSource`, whose tensors will get mapped.
names(list[str]): list of input names corresponding to the tensors
produced by ``input``.
Returns:
InputSource:
"""
ProxyInputSource.__init__(self, input) ProxyInputSource.__init__(self, input)
assert isinstance(names, (list, tuple)), names assert isinstance(names, (list, tuple)), names
self._names = tuple(names) self._names = tuple(names)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment