class LSTMSchema(RecurrentSchema): units = fields.Int() activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) recurrent_activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) kernel_initializer = fields.Nested(InitializerSchema, default=None, missing=None) recurrent_initializer = fields.Nested(InitializerSchema, default=None, missing=None) bias_initializer = fields.Nested(InitializerSchema, default=None, missing=None) unit_forget_bias = fields.Bool(default=True, missing=True) kernel_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) recurrent_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) bias_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) activity_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) kernel_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) recurrent_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) bias_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) dropout = fields.Float(default=0., missing=0.) recurrent_dropout = fields.Float(default=0., missing=0.) class Meta: ordered = True @post_load def make(self, data): return LSTMConfig(**data) @post_dump def unmake(self, data): return LSTMConfig.remove_reduced_attrs(data)
class Conv2DSchema(BaseLayerSchema): filters = fields.Int() kernel_size = ObjectOrListObject(fields.Int, min=2, max=2) strides = ObjectOrListObject(fields.Int, min=2, max=2, default=(1, 1), missing=(1, 1)) padding = fields.Str(default='valid', missing='valid', validate=validate.OneOf(['same', 'valid'])) data_format = fields.Str(default=None, missing=None, validate=validate.OneOf('channels_first', 'channels_last')) dilation_rate = ObjectOrListObject(fields.Int, min=2, max=2, default=(1, 1), missing=(1, 1)) activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) kernel_initializer = fields.Nested(InitializerSchema, allow_none=True) bias_initializer = fields.Nested(InitializerSchema, allow_none=True) kernel_regularizer = fields.Nested(RegularizerSchema, allow_none=True) bias_regularizer = fields.Nested(RegularizerSchema, allow_none=True) activity_regularizer = fields.Nested(RegularizerSchema, allow_none=True) kernel_constraint = fields.Nested(ConstraintSchema, allow_none=True) bias_constraint = fields.Nested(ConstraintSchema, allow_none=True) class Meta: ordered = True @post_load def make_load(self, data): return Conv2DConfig(**data)
class LSTMSchema(RecurrentSchema): units = fields.Int() activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) recurrent_activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) kernel_initializer = fields.Nested(InitializerSchema, default=None, missing=None) recurrent_initializer = fields.Nested(InitializerSchema, default=None, missing=None) bias_initializer = fields.Nested(InitializerSchema, default=None, missing=None) unit_forget_bias = fields.Bool(default=True, missing=True) kernel_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) recurrent_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) bias_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) activity_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) kernel_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) recurrent_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) bias_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) dropout = fields.Float(default=0., missing=0.) recurrent_dropout = fields.Float(default=0., missing=0.) @staticmethod def schema_config(): return LSTMConfig
class ActivationSchema(BaseLayerSchema): activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) class Meta: ordered = True @post_load def make_load(self, data): return ActivationConfig(**data)
class LocallyConnected1DSchema(BaseLayerSchema): filters = fields.Int() kernel_size = ObjectOrListObject(fields.Int, min=1, max=1) strides = ObjectOrListObject(fields.Int, min=1, max=1, default=1, missing=1) padding = fields.Str(default='valid', missing='valid', validate=validate.OneOf(['same', 'valid'])) data_format = fields.Str(default=None, missing=None, validate=validate.OneOf('channels_first', 'channels_last')) activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) kernel_initializer = fields.Nested(InitializerSchema, default=None, missing=None) bias_initializer = fields.Nested(InitializerSchema, default=None, missing=None) kernel_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) bias_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) activity_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) kernel_constraint = fields.Nested(RegularizerSchema, default=None, missing=None) bias_constraint = fields.Nested(RegularizerSchema, default=None, missing=None) class Meta: ordered = True @post_load def make(self, data): return LocallyConnected1DConfig(**data) @post_dump def unmake(self, data): return LocallyConnected1DConfig.remove_reduced_attrs(data)
class ActivationSchema(BaseLayerSchema): activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) class Meta: ordered = True @post_load def make(self, data): return ActivationConfig(**data) @post_dump def unmake(self, data): return ActivationConfig.remove_reduced_attrs(data)
class DenseSchema(BaseLayerSchema): units = fields.Int() activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(allow_none=True) kernel_initializer = fields.Nested(InitializerSchema, allow_none=True) bias_initializer = fields.Nested(InitializerSchema, allow_none=True) kernel_regularizer = fields.Nested(RegularizerSchema, allow_none=True) bias_regularizer = fields.Nested(RegularizerSchema, allow_none=True) activity_regularizer = fields.Nested(RegularizerSchema, allow_none=True) kernel_constraint = fields.Nested(ConstraintSchema, allow_none=True) bias_constraint = fields.Nested(ConstraintSchema, allow_none=True) @staticmethod def schema_config(): return DenseConfig
class SimpleRNNSchema(RecurrentSchema): units = fields.Int() activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) kernel_initializer = fields.Nested(InitializerSchema, default=None, missing=None) recurrent_initializer = fields.Nested(InitializerSchema, default=None, missing=None) bias_initializer = fields.Nested(InitializerSchema, default=None, missing=None) kernel_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) recurrent_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) bias_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) activity_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) kernel_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) recurrent_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) bias_constraint = fields.Nested(ConstraintSchema, default=None, missing=None) dropout = fields.Float(default=0., missing=0.) recurrent_dropout = fields.Float(default=0., missing=0.) class Meta: ordered = True @post_load def make_load(self, data): return SimpleRNNConfig(**data)
class DenseSchema(BaseLayerSchema): units = fields.Int() activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(allow_none=True) kernel_initializer = fields.Nested(InitializerSchema, allow_none=True) bias_initializer = fields.Nested(InitializerSchema, allow_none=True) kernel_regularizer = fields.Nested(RegularizerSchema, allow_none=True) bias_regularizer = fields.Nested(RegularizerSchema, allow_none=True) activity_regularizer = fields.Nested(RegularizerSchema, allow_none=True) kernel_constraint = fields.Nested(ConstraintSchema, allow_none=True) bias_constraint = fields.Nested(ConstraintSchema, allow_none=True) class Meta: ordered = True @post_load def make_load(self, data): return DenseConfig(**data)
class LocallyConnected2DSchema(BaseLayerSchema): filters = fields.Int() kernel_size = ObjectOrListObject(fields.Int, min=2, max=2) strides = ObjectOrListObject(fields.Int, min=2, max=2, default=(1, 1), missing=(1, 1)) padding = fields.Str(default='valid', missing='valid', validate=validate.OneOf(['same', 'valid'])) data_format = fields.Str(default=None, missing=None, validate=validate.OneOf('channels_first', 'channels_last')) activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) use_bias = fields.Bool(default=True, missing=True) kernel_initializer = fields.Nested(InitializerSchema, default=None, missing=None) bias_initializer = fields.Nested(InitializerSchema, default=None, missing=None) kernel_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) bias_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) activity_regularizer = fields.Nested(RegularizerSchema, default=None, missing=None) kernel_constraint = fields.Nested(RegularizerSchema, default=None, missing=None) bias_constraint = fields.Nested(RegularizerSchema, default=None, missing=None) @staticmethod def schema_config(): return LocallyConnected2DConfig
class ActivationSchema(BaseLayerSchema): activation = StrOrFct(allow_none=True, validate=validate.OneOf(ACTIVATION_VALUES)) @staticmethod def schema_config(): return ActivationConfig