---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-258-a94787ab7b89> in <module>()
26 if 'model2' in dir():
27 del model2
---> 28 model2 = build_model2()
29 EPOCHS = 1000
30 class PrintDot(keras.callbacks.Callback):
<ipython-input-258-a94787ab7b89> in build_model2()
16 layers.Dense(1,
17 kernel_initializer=rinit.get_C,
---> 18 bias_initializer=rinit.get_d)
19 ])
20 optimizer = tf.keras.optimizers.RMSprop(0.1)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/checkpointable/base.py in _method_wrapper(self, *args, **kwargs)
440 self._setattr_tracking = False # pylint: disable=protected-access
441 try:
--> 442 method(self, *args, **kwargs)
443 finally:
444 self._setattr_tracking = previous_value # pylint: disable=protected-access
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py in __init__(self, layers, name)
107 if layers:
108 for layer in layers:
--> 109 self.add(layer)
110
111 @property
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/checkpointable/base.py in _method_wrapper(self, *args, **kwargs)
440 self._setattr_tracking = False # pylint: disable=protected-access
441 try:
--> 442 method(self, *args, **kwargs)
443 finally:
444 self._setattr_tracking = previous_value # pylint: disable=protected-access
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py in add(self, layer)
178 # If the model is being built continuously on top of an input layer:
179 # refresh its output.
--> 180 output_tensor = layer(self.outputs[0])
181 if isinstance(output_tensor, list):
182 raise TypeError('All layers in a Sequential model '
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in __call__(self, inputs, *args, **kwargs)
536 if not self.built:
537 # Build layer if applicable (if the `build` method has been overridden).
--> 538 self._maybe_build(inputs)
539 # We must set self.built since user defined build functions are not
540 # constrained to set self.built.
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
1601 # Only call `build` if the user has manually overridden the build method.
1602 if not hasattr(self.build, '_is_default'):
-> 1603 self.build(input_shapes)
1604
1605 def __setattr__(self, name, value):
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/layers/core.py in build(self, input_shape)
956 constraint=self.bias_constraint,
957 dtype=self.dtype,
--> 958 trainable=True)
959 else:
960 self.bias = None
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in add_weight(self, name, shape, dtype, initializer, regularizer, trainable, constraint, partitioner, use_resource, synchronization, aggregation, **kwargs)
347 collections=collections,
348 synchronization=synchronization,
--> 349 aggregation=aggregation)
350 backend.track_variable(variable)
351
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/checkpointable/base.py in _add_variable_with_custom_getter(self, name, shape, dtype, initializer, getter, overwrite, **kwargs_for_getter)
605 new_variable = getter(
606 name=name, shape=shape, dtype=dtype, initializer=initializer,
--> 607 **kwargs_for_getter)
608
609 # If we set an initializer and the variable processed it, tracking will not
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer_utils.py in make_variable(name, shape, dtype, initializer, partition_info, trainable, caching_device, validate_shape, constraint, use_resource, collections, synchronization, aggregation, partitioner)
143 collections=collections,
144 synchronization=synchronization,
--> 145 aggregation=aggregation)
146 return v
147
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in __call__(cls, *args, **kwargs)
211 def __call__(cls, *args, **kwargs):
212 if cls is VariableV1:
--> 213 return cls._variable_v1_call(*args, **kwargs)
214 elif cls is Variable:
215 return cls._variable_v2_call(*args, **kwargs)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in _variable_v1_call(cls, initial_value, trainable, collections, validate_shape, caching_device, name, variable_def, dtype, expected_shape, import_scope, constraint, use_resource, synchronization, aggregation)
174 use_resource=use_resource,
175 synchronization=synchronization,
--> 176 aggregation=aggregation)
177
178 def _variable_v2_call(cls,
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in <lambda>(**kwargs)
153 aggregation=VariableAggregation.NONE):
154 """Call on Variable class. Useful to force the signature."""
--> 155 previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
156 for getter in ops.get_default_graph()._variable_creator_stack: # pylint: disable=protected-access
157 previous_getter = _make_getter(getter, previous_getter)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py in default_variable_creator(next_creator, **kwargs)
2486 caching_device=caching_device, name=name, dtype=dtype,
2487 constraint=constraint, variable_def=variable_def,
-> 2488 import_scope=import_scope)
2489 else:
2490 return variables.RefVariable(
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in __call__(cls, *args, **kwargs)
215 return cls._variable_v2_call(*args, **kwargs)
216 else:
--> 217 return super(VariableMetaclass, cls).__call__(*args, **kwargs)
218
219
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py in __init__(self, initial_value, trainable, collections, validate_shape, caching_device, name, dtype, variable_def, import_scope, constraint)
292 name=name,
293 dtype=dtype,
--> 294 constraint=constraint)
295
296 # pylint: disable=unused-argument
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py in _init_from_args(self, initial_value, trainable, collections, validate_shape, caching_device, name, dtype, constraint)
404 with ops.name_scope("Initializer"), ops.device(None):
405 initial_value = ops.convert_to_tensor(
--> 406 initial_value() if init_from_fn else initial_value,
407 name="initial_value", dtype=dtype)
408 self._handle = eager_safe_variable_handle(
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer_utils.py in <lambda>()
125 initializer = initializer(dtype=dtype)
126 init_val = lambda: initializer( # pylint: disable=g-long-lambda
--> 127 shape, dtype=dtype, partition_info=partition_info)
128 variable_dtype = dtype.base_dtype
129 if use_resource is None:
~/bitme/research/custom_layers.py in get_d(self, shape, dtype, partition_info)
85
86 def get_d(self, shape, dtype=None, partition_info=None):
---> 87 return self._get(self.d, shape, dtype, partition_info)
88
89 def _get(self, self_data, shape, dtype=None, partition_info=None):
~/bitme/research/custom_layers.py in _get(self, self_data, shape, dtype, partition_info)
90 shape = tuple(shape)
91 if self_data.shape != shape:
---> 92 raise ValueError('Shapes differ: (this) {} != {} (arg)'.format(self_data.shape, shape))
93 return ops.convert_to_tensor(self_data, dtype=dtype)
94
ValueError: Shapes differ: (this) (1, 1) != (1,) (arg)