1 from __future__
import absolute_import
2 from __future__
import division
3 from __future__
import print_function
4 from __future__
import unicode_literals
17 """Merge multiple ID_LISTs into a single ID_LIST 20 model: A layer model instance 21 input_record: Tuple (Struct) of ID_LIST features to be 25 the merged ID_LIST feature 27 def __init__(self, model, input_record, name='merged'):
28 super(MergeIdLists, self).__init__(model, name, input_record)
29 assert all(schema.equal_schemas(x, IdList)
for x
in input_record), \
30 "Inputs to MergeIdLists should all be IdLists." 32 assert all(record.items.metadata
is not None 33 for record
in self.input_record), \
34 "Features without metadata are not supported" 36 merge_dim = max(get_categorical_limit(record)
37 for record
in self.input_record)
38 assert merge_dim
is not None,
"Unbounded features are not supported" 44 blob=model.net.NextBlob(name),
48 def add_ops(self, net):
49 return net.MergeIdLists(self.input_record.field_blobs(),
50 self.output_schema.field_blobs())