def test_multiply(self): """Test that Multiply can be invoked.""" value1 = np.random.uniform(size=(2, 3)).astype(np.float32) value2 = np.random.uniform(size=(2, 3)).astype(np.float32) value3 = np.random.uniform(size=(2, 3)).astype(np.float32) with self.session() as sess: out_tensor = Multiply()(tf.constant(value1), tf.constant(value2), tf.constant(value3)) assert np.array_equal(value1 * value2 * value3, out_tensor.eval())
def test_Variable_pickle(): tg = TensorGraph() feature = Feature(shape=(tg.batch_size, 1)) layer = Variable(np.array([15.0])) output = Multiply(in_layers=[feature, layer]) tg.add_output(output) tg.set_loss(output) tg.build() tg.save()