You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
~\Anaconda3\lib\site-packages\keras\engine\sequential.py in add(self, layer)
164 # and create the node connecting the current layer
165 # to the input layer we just created.
--> 166 layer(x)
167 set_inputs = True
168 else:
~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs)
73 if _SYMBOLIC_SCOPE.value:
74 with get_graph().as_default():
---> 75 return func(*args, **kwargs)
76 else:
77 return func(*args, **kwargs)
~\Anaconda3\lib\site-packages\keras\engine\base_layer.py in call(self, inputs, **kwargs)
461 'You can build it manually via: '
462 'layer.build(batch_input_shape)')
--> 463 self.build(unpack_singleton(input_shapes))
464 self.built = True
465
~\Anaconda3\lib\site-packages\keras\layers\convolutional.py in build(self, input_shape)
139 name='kernel',
140 regularizer=self.kernel_regularizer,
--> 141 constraint=self.kernel_constraint)
142 if self.use_bias:
143 self.bias = self.add_weight(shape=(self.filters,),
~\Anaconda3\lib\site-packages\keras\engine\base_layer.py in add_weight(self, name, shape, dtype, initializer, regularizer, trainable, constraint)
277 if dtype is None:
278 dtype = self.dtype
--> 279 weight = K.variable(initializer(shape, dtype=dtype),
280 dtype=dtype,
281 name=name,
TypeError: initialize_weights() got an unexpected keyword argument 'dtype'
Is it related to my tf version?
My current tf version is 2.0 gpu
The text was updated successfully, but these errors were encountered:
You may try this way. Rename the second argument of the following functions as "dtype":
def initialize_weights(shape, dtype=None):
return np.random.normal(loc = 0.0, scale = 1e-2, size = shape)
def initialize_bias(shape, dtype=None):
return np.random.normal(loc = 0.5, scale = 1e-2, size = shape)
Hi! While running this part of code:
model = get_siamese_model((105, 105, 1))
model.summary()
I got this error:
TypeError Traceback (most recent call last)
in
----> 1 model = get_siamese_model((105, 105, 1))
2 model.summary()
in get_siamese_model(input_shape)
11 model = Sequential()
12 model.add(Conv2D(64, (10,10), activation='relu', input_shape=input_shape,
---> 13 kernel_initializer=initialize_weights, kernel_regularizer=l2(2e-4)))
14 model.add(MaxPooling2D())
15 model.add(Conv2D(128, (7,7), activation='relu',
~\Anaconda3\lib\site-packages\keras\engine\sequential.py in add(self, layer)
164 # and create the node connecting the current layer
165 # to the input layer we just created.
--> 166 layer(x)
167 set_inputs = True
168 else:
~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs)
73 if _SYMBOLIC_SCOPE.value:
74 with get_graph().as_default():
---> 75 return func(*args, **kwargs)
76 else:
77 return func(*args, **kwargs)
~\Anaconda3\lib\site-packages\keras\engine\base_layer.py in call(self, inputs, **kwargs)
461 'You can build it manually via: '
462 '
layer.build(batch_input_shape)
')--> 463 self.build(unpack_singleton(input_shapes))
464 self.built = True
465
~\Anaconda3\lib\site-packages\keras\layers\convolutional.py in build(self, input_shape)
139 name='kernel',
140 regularizer=self.kernel_regularizer,
--> 141 constraint=self.kernel_constraint)
142 if self.use_bias:
143 self.bias = self.add_weight(shape=(self.filters,),
~\Anaconda3\lib\site-packages\keras\engine\base_layer.py in add_weight(self, name, shape, dtype, initializer, regularizer, trainable, constraint)
277 if dtype is None:
278 dtype = self.dtype
--> 279 weight = K.variable(initializer(shape, dtype=dtype),
280 dtype=dtype,
281 name=name,
TypeError: initialize_weights() got an unexpected keyword argument 'dtype'
Is it related to my tf version?
My current tf version is 2.0 gpu
The text was updated successfully, but these errors were encountered: