ff62eb251b04b8301e71aee970bdb157f2649fa9,keras/layers/convolutional.py,Convolution2D,build,#Convolution2D#Any#,401
Before Change
self.W_shape = (self.nb_row, self.nb_col, stack_size, self.nb_filter)
else:
raise ValueError("Invalid dim_ordering:", self.dim_ordering)
self.W = self.init(self.W_shape, name="{}_W".format(self.name))
if self.bias:
self.b = K.zeros((self.nb_filter,), name="{}_b".format(self.name))
self.trainable_weights = [self.W, self.b]
else:
self.trainable_weights = [self.W]
self.regularizers = []
if self.W_regularizer:
self.W_regularizer.set_param(self.W)
self.regularizers.append(self.W_regularizer)
if self.bias and self.b_regularizer:
self.b_regularizer.set_param(self.b)
self.regularizers.append(self.b_regularizer)
if self.activity_regularizer:
self.activity_regularizer.set_layer(self)
self.regularizers.append(self.activity_regularizer)
self.constraints = {}
if self.W_constraint:
self.constraints[self.W] = self.W_constraint
if self.bias and self.b_constraint:
self.constraints[self.b] = self.b_constraint
if self.initial_weights is not None:
self.set_weights(self.initial_weights)
del self.initial_weights
self.built = True
After Change
self.initial_weights = weights
super(Convolution2D, self).__init__(**kwargs)
def build(self, input_shape):
if self.dim_ordering == "th":
stack_size = input_shape[1]
self.W_shape = (self.nb_filter, stack_size, self.nb_row, self.nb_col)
elif self.dim_ordering == "tf":
stack_size = input_shape[3]
self.W_shape = (self.nb_row, self.nb_col, stack_size, self.nb_filter)
else:
raise Exception("Invalid dim_ordering: " + self.dim_ordering)
self.W = self.add_weight(self.W_shape,
initializer=self.init,
name="{}_W".format(self.name),
regularizer=self.W_regularizer,
constraint=self.W_constraint)
if self.bias:
self.b = self.add_weight((self.nb_filter,),
initializer="zero",
name="{}_b".format(self.name),
regularizer=self.b_regularizer,
constraint=self.b_constraint)
else:
self.b = None
if self.initial_weights is not None:
self.set_weights(self.initial_weights)
del self.initial_weights
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 86
Instances
Project Name: keras-team/keras
Commit Name: ff62eb251b04b8301e71aee970bdb157f2649fa9
Time: 2016-12-14
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional.py
Class Name: Convolution2D
Method Name: build
Project Name: keras-team/keras
Commit Name: ff62eb251b04b8301e71aee970bdb157f2649fa9
Time: 2016-12-14
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional.py
Class Name: Convolution2D
Method Name: build
Project Name: keras-team/keras
Commit Name: ff62eb251b04b8301e71aee970bdb157f2649fa9
Time: 2016-12-14
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional.py
Class Name: Convolution3D
Method Name: build
Project Name: keras-team/keras
Commit Name: ff62eb251b04b8301e71aee970bdb157f2649fa9
Time: 2016-12-14
Author: francois.chollet@gmail.com
File Name: keras/layers/core.py
Class Name: MaxoutDense
Method Name: build