Beispiel #1
0
 def test_multi_key_multi_data(self):
     x, y = get_inputs_by_op(op=Op(inputs=["x", "y"]),
                             store={
                                 "x": 1,
                                 "y": [1, 2]
                             })
     self.assertEqual(x, 1)
     self.assertEqual(y, [1, 2])
Beispiel #2
0
 def test_multi_key_multi_data(self):
     batch = {}
     write_outputs_by_op(op=Op(outputs=["x", "y"]),
                         store=batch,
                         outputs=[1, [1, 2]])
     self.assertEqual(batch, {"x": 1, "y": [1, 2]})
Beispiel #3
0
 def test_single_key_multi_data(self):
     batch = {}
     write_outputs_by_op(op=Op(outputs="x"), store=batch, outputs=[1, 2])
     self.assertEqual(batch, {"x": [1, 2]})
Beispiel #4
0
 def test_single_key_single_data(self):
     batch = {}
     write_outputs_by_op(op=Op(outputs="x"), store=batch, outputs=1)
     self.assertEqual(batch, {"x": 1})
Beispiel #5
0
 def test_single_key_multi_data(self):
     data = get_inputs_by_op(op=Op(inputs="x"), store={"x": [1, 2]})
     self.assertEqual(data, [1, 2])
Beispiel #6
0
 def test_single_key_single_data(self):
     data = get_inputs_by_op(op=Op(inputs="x"), store={"x": 1})
     self.assertEqual(data, 1)
Beispiel #7
0
 def setUpClass(self):
     self.testop = Op(inputs="x", outputs="y", mode="train")