def __init__( self, config_string, num_layers, head_size, activation='tanh', use_bias=True, weight_initializer='xavier_normal', bias_initializer='zeros', gutter=False, gutter_bias=None, **kwargs): # Call parent's constructor LayerWithNeurons.__init__(self, activation, weight_initializer, use_bias, bias_initializer, **kwargs) HardDriver.__init__(self, config_string, head_size, gutter=gutter, gutter_bias=gutter_bias) self._num_layers = checker.check_positive_integer(num_layers) self._activation_string = activation self.output_scale = [self.total_size] self.write_heads = None
def __init__(self, output_dim=None, spatial_configs=None, reverse=False, activation='relu', use_bias=True, weight_initializer='xavier_normal', bias_initializer='zeros', **kwargs): assert isinstance(activation, str) self.activation_string = activation # Call parent's constructor LayerWithNeurons.__init__(self, activation, weight_initializer, use_bias, bias_initializer, **kwargs) assert not (output_dim is None and spatial_configs is None) self._spatial_groups = [] if spatial_configs is not None: self._spatial_groups = self._get_groups(spatial_configs) total_size = self._get_total_size(self._spatial_groups) if output_dim is None: output_dim = total_size assert output_dim == total_size self._output_dim = checker.check_positive_integer(output_dim) self._reverse = checker.check_type(reverse, bool) self.neuron_scale = [output_dim]
def __init__(self, num_classes, heads=1, sum_method=None, normalize=False, use_bias=True, weight_initializer='xavier_normal', bias_initializer='zeros', **kwargs): # Call parent's constructor LayerWithNeurons.__init__(self, None, weight_initializer, use_bias, bias_initializer, **kwargs) self.num_classes = checker.check_positive_integer(num_classes) self._heads = checker.check_positive_integer(heads) self._sum_method = sum_method self._normalize = checker.check_type(normalize, bool) self.neuron_scale = [num_classes]
def __init__(self, layer_width, num_layers, activation='relu', use_bias=True, weight_initializer='xavier_normal', bias_initializer='zeros', t_bias_initializer=-1, **kwargs): # Call parent's constructor LayerWithNeurons.__init__(self, activation, weight_initializer, use_bias, bias_initializer, **kwargs) self._layer_width = checker.check_positive_integer(layer_width) self._num_layers = checker.check_positive_integer(num_layers) assert isinstance(activation, str) self._activation_string = activation self._t_bias_initializer = initializers.get(t_bias_initializer)
def __init__(self, num_neurons, activation=None, use_bias=True, weight_initializer='xavier_normal', bias_initializer='zeros', prune_frac=0, **kwargs): # Call parent's constructor LayerWithNeurons.__init__(self, activation, weight_initializer, use_bias, bias_initializer, prune_frac=prune_frac, **kwargs) self.num_neurons = checker.check_positive_integer(num_neurons) self.neuron_scale = [num_neurons]