示例#1
0
  def test_crop_idempotent(self):
    crop_0_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=0)
    crop_1_lt = ops.random_crop(crop_0_lt, {'probs': 3, 'channel': 2}, seed=1)

    self.assertLabeledTensorsEqual(crop_0_lt, crop_1_lt)
示例#2
0
  def test_crop_idempotent(self):
    crop_0_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=0)
    crop_1_lt = ops.random_crop(crop_0_lt, {'probs': 3, 'channel': 2}, seed=1)

    self.assertLabeledTensorsEqual(crop_0_lt, crop_1_lt)
示例#3
0
  def test_different_seeds(self):
    crop_0_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=0)
    crop_1_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=1)

    self.assertEqual(crop_0_lt.axes, crop_1_lt.axes)
    [crop_0, crop_1] = self.eval([crop_0_lt.tensor, crop_1_lt.tensor])
    self.assertFalse((crop_0 == crop_1).all())
示例#4
0
  def test_different_seeds(self):
    crop_0_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=0)
    crop_1_lt = ops.random_crop(
        self.original_lt, {'probs': 3,
                           'channel': 2}, seed=1)

    self.assertEqual(crop_0_lt.axes, crop_1_lt.axes)
    [crop_0, crop_1] = self.eval([crop_0_lt.tensor, crop_1_lt.tensor])
    self.assertFalse((crop_0 == crop_1).all())
示例#5
0
    def test_double(self):
        crop_lt = ops.random_crop(self.original_lt, {'probs': 3, 'channel': 2})

        self.assertEqual(
            core.Axes(
                [self.a0, ('channel', 2), self.a2_resolved, ('probs', 3)]),
            crop_lt.axes)
示例#6
0
 def test_invalid_input(self):
     with self.assertRaises(ValueError):
         ops.random_crop(self.original_lt, {'foobar': 2})
示例#7
0
    def test_size1(self):
        crop_lt = ops.random_crop(self.original_lt, {'probs': 1})

        self.assertEqual(
            core.Axes([self.a0, self.a1, self.a2_resolved, ('probs', 1)]),
            crop_lt.axes)
示例#8
0
 def test_name(self):
     crop_lt = ops.random_crop(self.original_lt, {'probs': 3})
     self.assertIn('lt_random_crop', crop_lt.name)
示例#9
0
 def test_invalid_input(self):
   with self.assertRaises(ValueError):
     ops.random_crop(self.original_lt, {'foobar': 2})
示例#10
0
  def test_size1(self):
    crop_lt = ops.random_crop(self.original_lt, {'probs': 1})

    self.assertEqual(
        core.Axes([self.a0, self.a1, self.a2_resolved, ('probs', 1)]),
        crop_lt.axes)
示例#11
0
  def test_double(self):
    crop_lt = ops.random_crop(self.original_lt, {'probs': 3, 'channel': 2})

    self.assertEqual(
        core.Axes([self.a0, ('channel', 2), self.a2_resolved, ('probs', 3)]),
        crop_lt.axes)
示例#12
0
 def test_name(self):
   crop_lt = ops.random_crop(self.original_lt, {'probs': 3})
   self.assertIn('lt_random_crop', crop_lt.name)