Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
8cfcc47b
You need to sign in or sign up before continuing.
Commit
8cfcc47b
authored
Jan 13, 2020
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs
parent
3c14ff66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
tensorpack/input_source/input_source_base.py
tensorpack/input_source/input_source_base.py
+19
-16
No files found.
tensorpack/input_source/input_source_base.py
View file @
8cfcc47b
...
...
@@ -243,30 +243,33 @@ def remap_input_source(input, names):
except that the corresponding ones are replaced with the tensor produced
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:
.. code-block:: python
input1 = QueueInput(ds)
# assume ds produces 'image' and 'label', but the graph takes more
# inputs for some reasons, or takes inputs of a different order:
input_signature = [tf.TensorSpec((None,10), tf.float32, 'score'),
tf.TensorSpec((None,20,20,3), tf.float32, 'label'),
tf.TensorSpec((None,), tf.int32, 'image') ]
# assume ds produces data that should be fed to 'image' and 'label',
# but the graph takes more inputs for some reasons, or takes inputs
# of a different order, for example like the following:
# 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.setup(input_signature)
# now, input2.get_input_tensors() will return a placeholder for 'score',
# plus the tensors returned by input1.get_input_tensors()
# now, if input2 is used with the above input_signature, it will return a
# placeholder for 'score', plus the tensors returned by input1
"""
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
)
assert
isinstance
(
names
,
(
list
,
tuple
)),
names
self
.
_names
=
tuple
(
names
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment