3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
16 def __init__(self, model, input_record, num_splits, axis=1,
17 name=
'split', **kwargs):
18 super(Split, self).__init__(model, name, input_record, **kwargs)
26 "Incorrect input type. Excpected Scalar, but received: {0}".\
29 input_shape = input_record.field_type().shape
30 assert len(input_shape) >= axis
31 assert input_shape[axis] % num_splits == 0
33 output_shape = list(input_shape)
34 output_shape[axis] = int(output_shape[axis] / num_splits)
36 data_type = input_record.field_type().base
40 (data_type, output_shape),
41 self.get_next_blob_reference(
'output_{}'.format(i)),
43 for i
in range(num_splits)
47 def add_ops(self, net):
49 self.input_record.field_blobs(),
50 self.output_schema.field_blobs(),