[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix indentation error
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-kim committed Feb 26, 2020
1 parent 8574df2 commit c8fbd10
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sonnet/src/mixed_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def scope(dtype: tf.DType):
The global type is reset to its original value when the context is exited.::
snt.mixed_precision.enable(tf.float32)
snt.Linear.__call__ = snt.mixed_precision.modes([tf.float32, tf.float16])(snt.Linear.__call__)
mod = snt.Linear(10)
with snt.mixed_precision.scope(tf.float16):
y = mod(tf.ones([1, 1])) # First call will be done in F32.
y = mod(tf.ones([1, 1])) # MatMul/Add will be done in F16.
y = mod(tf.ones([1, 1])) # Outside the scope will be done in F32.
snt.mixed_precision.enable(tf.float32)
snt.Linear.__call__ = snt.mixed_precision.modes([tf.float32, tf.float16])(snt.Linear.__call__)
mod = snt.Linear(10)
with snt.mixed_precision.scope(tf.float16):
y = mod(tf.ones([1, 1])) # First call will be done in F32.
y = mod(tf.ones([1, 1])) # MatMul/Add will be done in F16.
y = mod(tf.ones([1, 1])) # Outside the scope will be done in F32.
Args:
dtype: type to set the mixed precision mode to.
Expand Down

0 comments on commit c8fbd10

Please sign in to comment.