def get_config(self): config = { 'units': self.units, 'eps': self.eps, 'use_bias': self.use_bias, 'activation': activations.serialize(self.activation), 'kernel_initializer': initializers.serialize(self.kernel_initializer), 'bias_initializer': initializers.serialize(self.bias_initializer), 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'activity_regularizer': regularizers.serialize(self.activity_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint) } base_config = super().get_config() return {**base_config, **config}
def get_config(self) -> dict: """Returns the config of the layer. The same layer can be reinstantiated later (without its trained weights) from this configuration. Returns: Python dictionary containing the configuration of the layer. """ config = {} # Include the Entangler-specific arguments args = ['output_dim', 'num_legs', 'num_levels', 'use_bias'] for arg in args: config[arg] = getattr(self, arg) # Serialize the activation config['activation'] = activations.serialize(getattr(self, 'activation')) # Serialize the initializers layer_initializers = ['kernel_initializer', 'bias_initializer'] for initializer_arg in layer_initializers: config[initializer_arg] = initializers.serialize( getattr(self, initializer_arg)) # Get base config base_config = super(DenseEntangler, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'rank': self.rank, 'filters': self.filters, 'kernel_size': self.kernel_size, 'strides': self.strides, 'padding': self.padding, 'data_format': self.data_format, 'dilation_rate': self.dilation_rate, 'activation': activations.serialize(self.activation), 'use_bias': self.use_bias, 'normalize_weight': self.normalize_weight, 'kernel_initializer': sanitizedInitSer(self.kernel_initializer), 'bias_initializer': sanitizedInitSer(self.bias_initializer), 'gamma_diag_initializer': sanitizedInitSer(self.gamma_diag_initializer), 'gamma_off_initializer': sanitizedInitSer(self.gamma_off_initializer), 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'gamma_diag_regularizer': regularizers.serialize(self.gamma_diag_regularizer), 'gamma_off_regularizer': regularizers.serialize(self.gamma_off_regularizer), 'activity_regularizer': regularizers.serialize(self.activity_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint), 'gamma_diag_constraint': constraints.serialize(self.gamma_diag_constraint), 'gamma_off_constraint': constraints.serialize(self.gamma_off_constraint), 'init_criterion': self.init_criterion, 'spectral_parametrization': self.spectral_parametrization, } base_config = super(ComplexConv, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { "units": self.units, "activation": activations.serialize(self.activation), "use_bias": self.use_bias, "kernel_quantizer": constraints.serialize(self.kernel_quantizer_internal), "bias_quantizer": constraints.serialize(self.bias_quantizer_internal), "kernel_initializer": initializers.serialize(self.kernel_initializer), "bias_initializer": initializers.serialize(self.bias_initializer), "kernel_regularizer": regularizers.serialize(self.kernel_regularizer), "bias_regularizer": regularizers.serialize(self.bias_regularizer), "activity_regularizer": regularizers.serialize(self.activity_regularizer), "kernel_constraint": constraints.serialize(self.kernel_constraint), "bias_constraint": constraints.serialize(self.bias_constraint), "kernel_range": self.kernel_range, "bias_range": self.bias_range } base_config = super(QDense, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'units': self.output_dim, 'activation': activations.serialize(self.activation), } base_config = super(GCNLayer, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'filters': self.filters, 'kernel_size': self.kernel_size, 'strides': self.strides, 'padding': self.padding, 'data_format': self.data_format, 'dilation_rate': self.dilation_rate, 'activation': activations.serialize(self.activation), 'recurrent_activation': activations.serialize(self.recurrent_activation), 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), 'recurrent_initializer': initializers.serialize(self.recurrent_initializer), 'bias_initializer': initializers.serialize(self.bias_initializer), 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'recurrent_constraint': constraints.serialize(self.recurrent_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint), 'dropout': self.dropout, 'recurrent_dropout': self.recurrent_dropout } base_config = super(ConvGRU2DCell, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def config(self): return { 'channels': self.channels, 'iterations': self.iterations, 'order': self.order, 'share_weights': self.share_weights, 'gcn_activation': activations.serialize(self.gcn_activation), 'dropout_rate': self.dropout_rate, }
def config(self): return { 'channels': self.channels, 'alpha': self.alpha, 'propagations': self.propagations, 'mlp_hidden': self.mlp_hidden, 'mlp_activation': activations.serialize(self.mlp_activation), 'dropout_rate': self.dropout_rate, }
def config(self): return { "channels": self.channels, "alpha": self.alpha, "propagations": self.propagations, "mlp_hidden": self.mlp_hidden, "mlp_activation": activations.serialize(self.mlp_activation), "dropout_rate": self.dropout_rate, }
def config(self): return { "channels": self.channels, "iterations": self.iterations, "order": self.order, "share_weights": self.share_weights, "gcn_activation": activations.serialize(self.gcn_activation), "dropout_rate": self.dropout_rate, }
def get_config(self): config = {'alpha': self.alpha, 'niter': self.niter, 'keep_prob': self.keep_prob, 'activation': activations.serialize(self.activation) } base_config = super(GraphConvolution, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = super().get_config() return dict(config, activation=activations.serialize(self.activation), add_biases=self.add_biases, projection_regularizer=regularizers.serialize( self.projection_regularizer), projection_dropout=self.projection_dropout, scaled_attention=self.scaled_attention)
def get_config(self): config = { 'alpha': self.alpha, 'propagations': self.propagations, 'mlp_hidden': self.mlp_hidden, 'mlp_activation': activations.serialize(self.mlp_activation), 'dropout_rate': self.dropout_rate, } base_config = super().get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'intermediate_size': self.intermediate_size, 'activation': activations.serialize(self.activation), 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), } base_config = super(FeedForward, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'units': self.units, 'n_experts': self.n_experts, 'expert_activation': activations.serialize(self.expert_activation), 'gating_activation': activations.serialize(self.gating_activation), 'use_expert_bias': self.use_expert_bias, 'use_gating_bias': self.use_gating_bias, 'expert_kernel_initializer_scale': self.expert_kernel_initializer_scale, 'gating_kernel_initializer_scale': self.gating_kernel_initializer_scale, 'expert_bias_initializer': initializers.serialize(self.expert_bias_initializer), 'gating_bias_initializer': initializers.serialize(self.gating_bias_initializer), 'expert_kernel_regularizer': regularizers.serialize(self.expert_kernel_regularizer), 'gating_kernel_regularizer': regularizers.serialize(self.gating_kernel_regularizer), 'expert_bias_regularizer': regularizers.serialize(self.expert_bias_regularizer), 'gating_bias_regularizer': regularizers.serialize(self.gating_bias_regularizer), 'expert_kernel_constraint': constraints.serialize(self.expert_kernel_constraint), 'gating_kernel_constraint': constraints.serialize(self.gating_kernel_constraint), 'expert_bias_constraint': constraints.serialize(self.expert_bias_constraint), 'gating_bias_constraint': constraints.serialize(self.gating_bias_constraint), 'activity_regularizer': regularizers.serialize(self.activity_regularizer) } base_config = super(DenseMoE, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'iterations': self.iterations, 'order': self.order, 'share_weights': self.share_weights, 'gcn_activation': activations.serialize(self.gcn_activation), 'dropout_rate': self.dropout_rate, } base_config = super().get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = super(ConvLinkage, self).get_config() config.update( dict( nlayers=self.nlayers, filters=self.filters, strides=self.strides, kernel_size=self.kernel_size, use_bias_first=self.use_bias_first, use_bias=self.use_bias, use_bias_last=self.use_bias_last, activation_first=self.activation_first, activation=activations.serialize(self.activation), activation_last=activations.serialize(self.activation_last), bias_regularizer=self.bias_regularizer, dropout_rate=self.dropout_rate, use_bn=self.use_bn, )) return config
def get_config(self): """ Part of keras layer interface, where the signature is converted into a dict Returns: configurational dictionary """ config = { "T": self.T, "n_hidden": self.n_hidden, "activation": activations.serialize(self.activation), "activation_lstm": activations.serialize(self.activation_lstm), "recurrent_activation": activations.serialize(self.recurrent_activation), "kernel_initializer": initializers.serialize(self.kernel_initializer), "recurrent_initializer": initializers.serialize(self.recurrent_initializer), "bias_initializer": initializers.serialize(self.bias_initializer), "use_bias": self.use_bias, "unit_forget_bias": self.unit_forget_bias, "kernel_regularizer": regularizers.serialize(self.kernel_regularizer), "recurrent_regularizer": regularizers.serialize(self.recurrent_regularizer), "bias_regularizer": regularizers.serialize(self.bias_regularizer), "kernel_constraint": constraints.serialize(self.kernel_constraint), "recurrent_constraint": constraints.serialize(self.recurrent_constraint), "bias_constraint": constraints.serialize(self.bias_constraint), } base_config = super().get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'units': self.units, 'activation': activations.serialize(self.activation), 'recurrent_activation': activations.serialize(self.recurrent_activation), 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), 'recurrent_initializer': initializers.serialize(self.recurrent_initializer), 'bias_initializer': initializers.serialize(self.bias_initializer), 'unit_forget_bias': self.unit_forget_bias, 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'activity_regularizer': regularizers.serialize(self.activity_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'recurrent_constraint': constraints.serialize(self.recurrent_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint), 'dropout': self.dropout, 'recurrent_dropout': self.recurrent_dropout, 'implementation': self.implementation } base_config = super(T1Time2VecLSTM, self).get_config() del base_config['cell'] return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'initializer': initializers.serialize(self.initializer), 'activation': activations.serialize(self.activation), 'activity_regularizer': regularizers.serialize(self.activity_regularizer) } base_config = super(RawWeights, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def serialize_kwarg(key, attr): if key.endswith("_initializer"): return initializers.serialize(attr) if key.endswith("_regularizer"): return regularizers.serialize(attr) if key.endswith("_constraint"): return constraints.serialize(attr) if key == "activation": return activations.serialize(attr) if key == "use_bias": return attr
def serialize_kwarg(key, attr): if key.endswith('_initializer'): return initializers.serialize(attr) if key.endswith('_regularizer'): return regularizers.serialize(attr) if key.endswith('_constraint'): return constraints.serialize(attr) if key == 'activation': return activations.serialize(attr) if key == 'use_bias': return attr
def get_config(self): config = { 'units': self.units, 'activation': [ activations.serialize(act) for act in self.activation ], 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), } base_config = super(FeedForward, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = super().get_config() config.update({ 'max_len': None if self.max_len is None else self.max_len + 2, 'filters': self.filters, 'kernels': self.kernels, 'char_dim': self.char_dim, 'activation': activations.serialize(self.activation), 'highways': self.highways }) return config
def get_config(self): config = super(LocalLasso, self).get_config() config.update( dict( implementation=self.implementation, kernel_regularizer=self.kernel_regularizer, activity_regularizer=self.activity_regularizer, nonneg=self.nonneg, activation=activations.serialize(self.activation), use_bias=self.use_bias, )) return config
def get_config(self): config = { 'center': self.center, 'scale': self.scale, 'epsilon': self.epsilon, 'conditional': self.conditional, 'hidden_units': self.hidden_units, 'hidden_activation': activations.serialize(self.hidden_activation), 'hidden_initializer': initializers.serialize(self.hidden_initializer), } base_config = super(LayerNormalization, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'units': self.units, 'learning_rate': self.learning_rate, 'online': self.online, 'n_passes': self.n_passes, 'return_hidden': self.return_hidden, 'visible_activation': activations.serialize(self.visible_activation), 'hidden_activation': activations.serialize(self.hidden_activation), 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), 'bias_initializer': initializers.serialize(self.bias_initializer), 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'activity_regularizer': regularizers.serialize(self.activity_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint), 'optimizer': optimizers.serialize(self.optimizer) } base_config = super(OnlineBolzmannCell, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): """ Gets class configuration for Keras serialization. Used by keras model serialization. Returns: A dictionary that contains the config of the layer """ config = { "units": self.units, "use_bias": self.use_bias, "final_layer": self.final_layer, "activation": activations.serialize(self.activation), "kernel_initializer": initializers.serialize(self.kernel_initializer), "basis_initializer": initializers.serialize(self.basis_initializer), "coefficient_initializer": initializers.serialize(self.coefficient_initializer), "bias_initializer": initializers.serialize(self.bias_initializer), "kernel_regularizer": regularizers.serialize(self.kernel_regularizer), "basis_regularizer": regularizers.serialize(self.basis_regularizer), "coefficient_regularizer": regularizers.serialize(self.coefficient_regularizer), "bias_regularizer": regularizers.serialize(self.bias_regularizer), "kernel_constraint": constraints.serialize(self.kernel_constraint), "basis_constraint": constraints.serialize(self.basis_constraint), "coefficient_constraint": constraints.serialize(self.coefficient_constraint), "bias_constraint": constraints.serialize(self.bias_constraint), "num_relationships": self.num_relationships, "num_bases": self.num_bases, } base_config = super().get_config() return {**base_config, **config}
def get_config(self): config = { 'num_capsule': self.num_capsule, 'dim_capsule': self.dim_capsule, 'routings': self.routings, 'share_weights': self.share_weights, 'activation': activations.serialize(self.activation), 'regularizer': regularizers.serialize(self.regularizer), 'initializer': initializers.serialize(self.initializer), 'constraint': constraints.serialize(self.constraint) } base_config = super(Capsule, self).get_config() return dict(list(base_config.items()) + list(config.items()))
def get_config(self): config = { 'channels': self.channels, 'activation': activations.serialize(self.activation), 'use_bias': self.use_bias, 'kernel_initializer': initializers.serialize(self.kernel_initializer), 'bias_initializer': initializers.serialize(self.bias_initializer), 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), 'bias_regularizer': regularizers.serialize(self.bias_regularizer), 'kernel_constraint': constraints.serialize(self.kernel_constraint), 'bias_constraint': constraints.serialize(self.bias_constraint) } base_config = super().get_config() return dict(list(base_config.items()) + list(config.items()))