Example #1
0
  def test(self):
    pack_lt = ops.pack([self.original_lt, self.original_lt], 'batch')
    golden_lt = core.LabeledTensor(
        array_ops.stack([self.original_lt.tensor, self.original_lt.tensor]),
        ['batch', self.a0, self.a1, self.a2, self.a3])

    self.assertLabeledTensorsEqual(pack_lt, golden_lt)
Example #2
0
  def test(self):
    pack_lt = ops.pack([self.original_lt, self.original_lt], 'batch')
    golden_lt = core.LabeledTensor(
        array_ops.stack([self.original_lt.tensor, self.original_lt.tensor]),
        ['batch', self.a0, self.a1, self.a2, self.a3])

    self.assertLabeledTensorsEqual(pack_lt, golden_lt)
Example #3
0
    def setUp(self):
        super(ShuffleBatchTest, self).setUp()

        tensors = []
        for i in range(10):
            offset_lt = core.LabeledTensor(constant_op.constant(i), [])
            tensors.append(core.add(self.original_lt, offset_lt))
        self.pack_lt = ops.pack(tensors, 'batch')
Example #4
0
  def setUp(self):
    super(ShuffleBatchTest, self).setUp()

    tensors = []
    for i in range(10):
      offset_lt = core.LabeledTensor(constant_op.constant(i), [])
      tensors.append(core.add(self.original_lt, offset_lt))
    self.pack_lt = ops.pack(tensors, 'batch')
Example #5
0
  def test_no_enqueue_many(self):
    [batch_2_op] = ops.batch([self.original_lt], batch_size=2)
    self.assertEqual(len(batch_2_op.axes['batch']), 2)

    [batch_10_op] = ops.batch([batch_2_op], batch_size=10, enqueue_many=True)

    self.assertLabeledTensorsEqual(
        ops.pack(10 * [self.original_lt], 'batch'), batch_10_op)
Example #6
0
  def test_no_enqueue_many(self):
    [batch_2_op] = ops.batch([self.original_lt], batch_size=2)
    self.assertEqual(len(batch_2_op.axes['batch']), 2)

    [batch_10_op] = ops.batch([batch_2_op], batch_size=10, enqueue_many=True)

    self.assertLabeledTensorsEqual(
        ops.pack(10 * [self.original_lt], 'batch'), batch_10_op)
Example #7
0
  def test_axis(self):
    pack_lt = ops.pack(
        [self.original_lt, self.original_lt], new_axis='batch', axis_position=4)
    golden_lt = core.LabeledTensor(
        array_ops.stack(
            [self.original_lt.tensor, self.original_lt.tensor], axis=4),
        [self.a0, self.a1, self.a2, self.a3, 'batch'])

    self.assertLabeledTensorsEqual(pack_lt, golden_lt)
Example #8
0
  def test_axis(self):
    pack_lt = ops.pack(
        [self.original_lt, self.original_lt], new_axis='batch', axis_position=4)
    golden_lt = core.LabeledTensor(
        array_ops.stack(
            [self.original_lt.tensor, self.original_lt.tensor], axis=4),
        [self.a0, self.a1, self.a2, self.a3, 'batch'])

    self.assertLabeledTensorsEqual(pack_lt, golden_lt)
Example #9
0
 def test_invalid_input(self):
     with self.assertRaises(ValueError):
         ops.pack([self.original_lt, self.original_lt], 'channel')
Example #10
0
 def test_name(self):
     pack_lt = ops.pack([self.original_lt, self.original_lt], 'batch')
     self.assertIn('lt_pack', pack_lt.name)
Example #11
0
 def test_invalid_input(self):
   with self.assertRaises(ValueError):
     ops.pack([self.original_lt, self.original_lt], 'channel')
Example #12
0
 def test_name(self):
   pack_lt = ops.pack([self.original_lt, self.original_lt], 'batch')
   self.assertIn('lt_pack', pack_lt.name)