Esempio n. 1
0
 def test_passed_tuple_as_tag(self):
   with self.assertRaisesRegexp(
       TypeError,
       r'Attempting to create a TaggedOutput with non-string tag \(1, 2, 3\)'):
     TaggedOutput((1, 2, 3), 'value')
Esempio n. 2
0
 def process(self, element, train_size, val_label):
     """Randomly assigns element to training or validation set."""
     if random.random() > train_size:
         yield TaggedOutput(val_label, element)
     else:
         yield element
Esempio n. 3
0
 def mux_input(x):
     if isinstance(x, int):
         yield TaggedOutput('numbers', x)
     else:
         yield TaggedOutput('letters', x)
Esempio n. 4
0
 def process(self, element):
     e = json.loads(element)
     yield TaggedOutput(e.pop('_Dest'), e)