Skip to content

Commit

Permalink
Merge pull request tensorflow#1466 from emilyfertig/r0.15
Browse files Browse the repository at this point in the history
R0.15
  • Loading branch information
emilyfertig authored Nov 17, 2021
2 parents 76eaa7e + 47f35da commit f377715
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
5 changes: 3 additions & 2 deletions tensorflow_probability/python/bijectors/blockwise_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ def call_forward(bij, x):
self.assertAllClose(call_forward(unflat, x), blockwise.forward(x))

# Type spec can be encoded/decoded.
enc = tf.__internal__.saved_model.encode_structure(blockwise._type_spec)
dec = tf.__internal__.saved_model.decode_proto(enc)
struct_coder = tf.__internal__.saved_model.StructureCoder()
enc = struct_coder.encode_structure(blockwise._type_spec)
dec = struct_coder.decode_proto(enc)
self.assertEqual(blockwise._type_spec, dec)

def testNonCompositeTensor(self):
Expand Down
5 changes: 3 additions & 2 deletions tensorflow_probability/python/bijectors/chain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ def call_forward(bij, x):
self.assertAllClose(call_forward(unflat, x), chain.forward(x))

# TypeSpec can be encoded/decoded.
enc = tf.__internal__.saved_model.encode_structure(chain._type_spec)
dec = tf.__internal__.saved_model.decode_proto(enc)
struct_coder = tf.__internal__.saved_model.StructureCoder()
enc = struct_coder.encode_structure(chain._type_spec)
dec = struct_coder.decode_proto(enc)
self.assertEqual(chain._type_spec, dec)

def testNonCompositeTensor(self):
Expand Down
5 changes: 3 additions & 2 deletions tensorflow_probability/python/bijectors/joint_map_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ def call_forward(bij, x):
self.assertAllCloseNested(call_forward(unflat, x), bij.forward(x))

# Type spec can be encoded/decoded.
enc = tf.__internal__.saved_model.encode_structure(bij._type_spec)
dec = tf.__internal__.saved_model.decode_proto(enc)
struct_coder = tf.__internal__.saved_model.StructureCoder()
enc = struct_coder.encode_structure(bij._type_spec)
dec = struct_coder.decode_proto(enc)
self.assertEqual(bij._type_spec, dec)

def testNonCompositeTensor(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ def composite_helper(v):
mk_err_msg('(Unable to convert dependent entry \'{}\' of object '
'\'{}\': {})'.format(k, obj, str(e))))
result = cls(**kwargs)
struct_coder = nested_structure_coder.StructureCoder()
try:
nested_structure_coder.encode_structure(result._type_spec) # pylint: disable=protected-access
struct_coder.encode_structure(result._type_spec) # pylint: disable=protected-access
except nested_structure_coder.NotEncodableError as e:
raise NotImplementedError(
mk_err_msg('(Unable to serialize: {})'.format(str(e))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ def test_save_restore_functor(self):
a = tf.constant([3., 2.])
ct = ThingWithCallableArg(a, f=f)

struct_coder = tf.__internal__.saved_model.StructureCoder()
with self.assertRaisesRegex(ValueError, 'Cannot serialize'):
tf.__internal__.saved_model.encode_structure(ct._type_spec) # pylint: disable=protected-access
struct_coder.encode_structure(ct._type_spec) # pylint: disable=protected-access

@tfp.experimental.auto_composite_tensor(module_name='my.module')
class F(tfp.experimental.AutoCompositeTensor):
Expand All @@ -372,8 +373,8 @@ def __call__(self, *args, **kwargs):
return f(*args, **kwargs)

ct_functor = ThingWithCallableArg(a, f=F())
enc = tf.__internal__.saved_model.encode_structure(ct_functor._type_spec)
dec = tf.__internal__.saved_model.decode_proto(enc)
enc = struct_coder.encode_structure(ct_functor._type_spec)
dec = struct_coder.decode_proto(enc)
self.assertEqual(dec, ct_functor._type_spec)

def test_composite_tensor_callable_arg(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class SimpleStepSizeAdaptationStaticBroadcastingTest(test_util.TestCase):
)
def testBroadcasting(self, old_step_size, new_step_size):
log_accept_ratio = tf.constant(
[[np.log(0.73), np.log(0.76), np.log(0.73)],
[[np.log(0.72), np.log(0.76), np.log(0.73)],
[np.log(0.77), np.log(0.77), np.log(0.73)]],
dtype=tf.float64)
log_accept_ratio = tf1.placeholder_with_default(
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_probability/python/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# stable release (indicated by `_VERSION_SUFFIX = ''`). Outside the context of a
# release branch, the current version is by default assumed to be a
# 'development' version, labeled 'dev'.
_VERSION_SUFFIX = 'dev'
_VERSION_SUFFIX = ''

# Example, '0.4.0-dev'
__version__ = '.'.join([
Expand Down

0 comments on commit f377715

Please sign in to comment.