Commit 19bd8ac8 authored by abster12's avatar abster12
Browse files

rewriting tests

parent 220589af
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -881,9 +881,11 @@ class TestLayers(test_util.TensorFlowTestCase):

    labels = 2
    logits = 0.0001
    input_tensor = np.random.uniform(labels, logits, [1, 1])
    logits_tensor = np.random.uniform(logits)
    labesl_tensor = np.random.rand(labels)
    with self.test_session() as sess:
      input_tensor = tf.convert_to_tensor(input_tensor, dtype=tf.float32)
      out_tensor = Hingeloss()(input_tensor)
      logits_tensor = tf.convert_to_tensor(logits_tensor, dtype=tf.float32)
      labels_tesnor = tf.convert_to_tensor(labels_tensor, dtype=tf.float32)
      out_tensor = Hingeloss()(labels_tensor, logits_tensor)
      out_tensor = out_tensor.eval()
      assert type(out_tensor) is FloatType
      assert out_tensor.shape == (labels,)
+3 −1
Original line number Diff line number Diff line
@@ -685,9 +685,11 @@ def test_Slice_pickle():


def test_hingeloss_pickle():
  lables = 2
  logits = 0.001
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = Hingeloss(in_layers=[feature, feature])
  layer = Hingeloss(labels=labels, logits=logits, in_layers=[feature, feature])
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()