Beispiel #1
0
 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())
Beispiel #2
0
 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())
Beispiel #3
0
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()