Ejemplo 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')
Ejemplo 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
Ejemplo n.º 3
0
 def mux_input(x):
     if isinstance(x, int):
         yield TaggedOutput('numbers', x)
     else:
         yield TaggedOutput('letters', x)
Ejemplo n.º 4
0
 def process(self, element):
     e = json.loads(element)
     yield TaggedOutput(e.pop('_Dest'), e)