Ejemplo n.º 1
0
 def to_dict(self):
     return {
         MakiRestorable.FIELD_TYPE: ActivationLayer.TYPE,
         MakiRestorable.PARAMS: {
             MakiRestorable.NAME: self.get_name(),
             ActivationLayer.ACTIVATION: ActivationConverter.activation_to_str(self.f)
         }
     }
Ejemplo n.º 2
0
 def to_dict(self):
     return {
         'type': 'ActivationLayer',
         'params': {
             'name': self._name,
             'activation': ActivationConverter.activation_to_str(self.f)
         }
     }
Ejemplo n.º 3
0
    def build(params: dict):
        activation = ActivationConverter.str_to_activation(params[ActivationLayer.ACTIVATION])
        name = params[MakiRestorable.NAME]

        return ActivationLayer(
            activation=activation,
            name=name
        )
Ejemplo n.º 4
0
 def to_dict(self):
     return {
         'type': 'DenseLayer',
         'params': {
             'name': self._name,
             'input_shape': self.input_shape,
             'output_shape': self.output_shape,
             'activation': ActivationConverter.activation_to_str(self.f),
             'use_bias': self.use_bias,
             'init_type': self.init_type
         }
     }
Ejemplo n.º 5
0
 def to_dict(self):
     return {
         MakiRestorable.FIELD_TYPE: LSTMLayer.TYPE,
         MakiRestorable.PARAMS: {
             MakiRestorable.NAME: self._name,
             LSTMLayer.NUM_CELLS: self._num_cells,
             LSTMLayer.INPUT_DIM: self._input_dim,
             LSTMLayer.SEQ_LENGTH: self._seq_length,
             LSTMLayer.DYNAMIC: self._dynamic,
             LSTMLayer.BIDIRECTIONAL: self._bidirectional,
             LSTMLayer.ACTIVATION: ActivationConverter.activation_to_str(self._f)
         }
     }
Ejemplo n.º 6
0
 def to_dict(self):
     return {
         'type': 'AtrousConvLayer',
         'params': {
             'name': self._name,
             'shape': list(self.shape),
             'rate': self.rate,
             'padding': self.padding,
             'activation': ActivationConverter.activation_to_str(self.f),
             'use_bias': self.use_bias,
             'init_type': self.init_type
         }
     }
Ejemplo n.º 7
0
 def to_dict(self):
     return {
         'type': 'LSTMLayer',
         'params': {
             'num_cells': self.num_cells,
             'input_dim': self.input_dim,
             'seq_length': self.seq_length,
             'name': self.name,
             'dynamic': self.dynamic,
             'bidirectional': self.bidirectional,
             'activation': ActivationConverter.activation_to_str(self.f)
         }
     }
Ejemplo n.º 8
0
 def to_dict(self):
     return {
         'type': 'SeparableConvLayer',
         'params': {
             'name': self._name,
             'dw_shape': list(self.dw_shape),
             'out_f': self.out_f,
             'stride': self.stride,
             'padding': self.padding,
             'activation': ActivationConverter.activation_to_str(self.f),
             'use_bias': self.use_bias,
             'dw_init_type': self.dw_init_type,
             'pw_init_type': self.pw_init_type
         }
     }
Ejemplo n.º 9
0
 def build(params: dict):
     num_cells = params[LSTMLayer.NUM_CELLS]
     input_dim = params[LSTMLayer.INPUT_DIM]
     seq_length = params[LSTMLayer.SEQ_LENGTH]
     name = params[MakiRestorable.NAME]
     dynamic = params[LSTMLayer.DYNAMIC]
     bidirectional = params[LSTMLayer.BIDIRECTIONAL]
     activation = ActivationConverter.str_to_activation(params[LSTMLayer.ACTIVATION])
     return LSTMLayer(
         in_d=num_cells,
         out_d=input_dim,
         seq_length=seq_length,
         name=name,
         activation=activation,
         dynamic=dynamic,
         bidirectional=bidirectional
     )