|
18 | 18 | from unittest import mock
|
19 | 19 |
|
20 | 20 | from google.protobuf import text_format
|
| 21 | +import numpy as np |
21 | 22 | import tensorflow as tf
|
22 | 23 |
|
23 | 24 | from tensorboard.plugins.hparams import _keras
|
@@ -150,19 +151,18 @@ def test_explicit_writer(self):
|
150 | 151 | # We'll assume that the contents are correct, as in the case where
|
151 | 152 | # the file writer was constructed implicitly.
|
152 | 153 |
|
153 |
| - # def test_non_eager_failure(self): |
154 |
| - # with tf.compat.v1.Graph().as_default(): |
155 |
| - # assert not tf.executing_eagerly() |
156 |
| - # self._initialize_model(writer=self.logdir) |
157 |
| - # with self.assertRaisesRegex( |
158 |
| - # RuntimeError, "only supported in TensorFlow eager mode" |
159 |
| - # ): |
160 |
| - # self.model.fit( |
161 |
| - # x=tf.constant([(1,)]), |
162 |
| - # y=tf.constant([(2,)]), |
163 |
| - # steps_per_epoch=1, |
164 |
| - # callbacks=[self.callback], |
165 |
| - # ) |
| 154 | + def test_non_eager_failure(self): |
| 155 | + with tf.compat.v1.Graph().as_default(): |
| 156 | + assert not tf.executing_eagerly() |
| 157 | + self._initialize_model(writer=self.logdir) |
| 158 | + with self.assertRaisesRegex( |
| 159 | + RuntimeError, "only supported in TensorFlow eager mode" |
| 160 | + ): |
| 161 | + self.model.fit( |
| 162 | + x=np.ones((1,)), |
| 163 | + y=np.ones((1,)), |
| 164 | + callbacks=[self.callback], |
| 165 | + ) |
166 | 166 |
|
167 | 167 | def test_reuse_failure(self):
|
168 | 168 | self._initialize_model(writer=self.logdir)
|
|
0 commit comments