def test_same_shape_exceptions(self, x_input, y_input, x_shape, y_shape, exception_cls, error_string): x = tf.placeholder(tf.int32, shape=x_shape) y = tf.placeholder(tf.int32, shape=y_shape) with tf.Session() as sess: with self.assertRaisesRegexp(exception_cls, error_string): sess.run(tf_utils.assert_same_shape(x, y), {x: x_input, y: y_input})
def test_same_shape(self): with tf.compat.v1.Session() as sess: input_list = [[1], [2], [3]] x = tf.compat.v1.placeholder(tf.int32, shape=None) y = tf.compat.v1.placeholder(tf.int32, shape=None) x_return = sess.run(tf_utils.assert_same_shape(x, y), { x: input_list, y: input_list }) self.assertAllEqual(x_return, input_list)
def _assert_shape(x, y): x_return, _ = tf_utils.assert_same_shape(x, y) return x_return
def _assert_shape(x, y): return tf_utils.assert_same_shape(x, y)