1 from __future__
import absolute_import
2 from __future__
import division
3 from __future__
import print_function
4 from __future__
import unicode_literals
14 This layer aims to build a mapping from raw keys to indices within [0, max_index). 15 The mapping is continuously built during training. The mapping will be frozen during 16 evaluation and prediction. Unseen keys will be assigned to index 0. 26 super(MapToRange, self).__init__(model, name, input_record, **kwargs)
36 initializer=(
'LongIndexCreate', {
'max_elements': self.
max_index}),
37 optimizer=model.NoOptim
49 def add_train_ops(self, net):
50 if self.input_record.field_type().base != np.int64:
53 net.NextScopedBlob(
"indices_before_mapping"),
54 to=core.DataType.INT64
60 indices = net.IndexGet([self.
handler, keys],
61 self.output_schema.indices())
63 net.StopGradient(indices, indices)
65 def add_eval_ops(self, net):
69 def add_ops(self, net):
def get_next_blob_reference(self, name)
def add_train_ops(self, net)
def add_eval_ops(self, net)
def create_param(self, param_name, shape, initializer, optimizer, ps_param=None, regularizer=None)