as_numpy_dtype is a property, not a method.

This makes explicit that as_numpy_dtype(0) returns a scalar value, not a dtype.

PiperOrigin-RevId: 286186716
Change-Id: Iadf0e8f95193c5ad7473d8cc72a7eaffbb271f52
This commit is contained in:
Brian Patton 2019-12-18 07:22:47 -08:00 committed by TensorFlower Gardener
parent 949b18f0fe
commit 77cb370373

View File

@ -121,14 +121,14 @@ class AdadeltaOptimizerTest(test.TestCase):
# TODO(lxuechen): This is hard to test in eager mode
for slot_idx in range(2):
self.assertAllCloseAccordingToType(
np.array([accum, accum], dtype=dtype.as_numpy_dtype()),
np.array([accum, accum], dtype=dtype.as_numpy_dtype(0)),
self.evaluate(slot[slot_idx]),
rtol=1e-5)
self.assertAllCloseAccordingToType(
np.array(
[accum_update, accum_update],
dtype=dtype.as_numpy_dtype()),
dtype=dtype.as_numpy_dtype(0)),
self.evaluate(slot_update[slot_idx]),
rtol=1e-5)
@ -136,14 +136,14 @@ class AdadeltaOptimizerTest(test.TestCase):
self.assertAllCloseAccordingToType(
np.array(
[var0_init[0] - tot_update, var0_init[1] - tot_update],
dtype=dtype.as_numpy_dtype()),
dtype=dtype.as_numpy_dtype(0)),
self.evaluate(var0),
rtol=1e-5)
self.assertAllCloseAccordingToType(
np.array(
[var1_init[0] - tot_update, var1_init[1] - tot_update],
dtype=dtype.as_numpy_dtype()),
dtype=dtype.as_numpy_dtype(0)),
self.evaluate(var1),
rtol=1e-5)