def test_batch_forward(self): op = LambdaOp(fn=np.sum) data = tf.convert_to_tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) result = op.forward_batch(data=[data], state={}) ans = np.array([6, 15, 24], dtype=np.float32) self.assertTrue(np.array_equal(result, ans))
def test_batch_forward(self): op = LambdaOp(fn=np.sum) data = tf.convert_to_tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) result = op.forward_batch(data=[data], state={}) self.assertEqual(result, 45)