Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
13530934
baselines
Commits
5c80997d
Commit
5c80997d
authored
May 26, 2017
by
Szymon Sidor
Committed by
GitHub
May 26, 2017
Browse files
Merge pull request #9 from AAorris/patch-1
tf_util: spelling / docstring updates
parents
7327a156
2361220d
Changes
1
Hide whitespace changes
Inline
Side-by-side
baselines/common/tf_util.py
View file @
5c80997d
...
@@ -52,7 +52,7 @@ def argmax(x, axis=None):
...
@@ -52,7 +52,7 @@ def argmax(x, axis=None):
def
switch
(
condition
,
then_expression
,
else_expression
):
def
switch
(
condition
,
then_expression
,
else_expression
):
'''
Switches between two operations depending on a scalar value (int or bool).
"""
Switches between two operations depending on a scalar value (int or bool).
Note that both `then_expression` and `else_expression`
Note that both `then_expression` and `else_expression`
should be symbolic tensors of the *same shape*.
should be symbolic tensors of the *same shape*.
...
@@ -60,7 +60,7 @@ def switch(condition, then_expression, else_expression):
...
@@ -60,7 +60,7 @@ def switch(condition, then_expression, else_expression):
condition: scalar tensor.
condition: scalar tensor.
then_expression: TensorFlow operation.
then_expression: TensorFlow operation.
else_expression: TensorFlow operation.
else_expression: TensorFlow operation.
'''
"""
x_shape
=
copy
.
copy
(
then_expression
.
get_shape
())
x_shape
=
copy
.
copy
(
then_expression
.
get_shape
())
x
=
tf
.
cond
(
tf
.
cast
(
condition
,
'bool'
),
x
=
tf
.
cond
(
tf
.
cast
(
condition
,
'bool'
),
lambda
:
then_expression
,
lambda
:
then_expression
,
...
@@ -362,9 +362,9 @@ def dropout(x, pkeep, phase=None, mask=None):
...
@@ -362,9 +362,9 @@ def dropout(x, pkeep, phase=None, mask=None):
def
function
(
inputs
,
outputs
,
updates
=
None
,
givens
=
None
):
def
function
(
inputs
,
outputs
,
updates
=
None
,
givens
=
None
):
"""Just like Theano function. Take a bunch of tensorflow placeholders and exp
e
rsions
"""Just like Theano function. Take a bunch of tensorflow placeholders and expr
es
sions
computed based on those placeholders and produces f(inputs) -> outputs. Function f takes
computed based on those placeholders and produces f(inputs) -> outputs. Function f takes
values to be fe
e
d to the inputs placeholders and produces the values of the exp
e
ressions
values to be fed to the input
'
s placeholders and produces the values of the expressions
in outputs.
in outputs.
Input values can be passed in the same order as inputs or can be provided as kwargs based
Input values can be passed in the same order as inputs or can be provided as kwargs based
...
...
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