Skip to content

Commit 20d8f14

Browse files
Fixed bug "TypeError: Layer.add_weight() got multiple values for argument 'shape'"
Google Colab thought "weight" and "bias" were being given for the "shape" argument, so I specified that these are the names of the variable and that fixed it.
1 parent ed77bdc commit 20d8f14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lab1/Part1_TensorFlow.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@
340340
" d = int(input_shape[-1])\n",
341341
" # Define and initialize parameters: a weight matrix W and bias b\n",
342342
" # Note that parameter initialization is random!\n",
343-
" self.W = self.add_weight(\"weight\", shape=[d, self.n_output_nodes]) # note the dimensionality\n",
344-
" self.b = self.add_weight(\"bias\", shape=[1, self.n_output_nodes]) # note the dimensionality\n",
343+
" self.W = self.add_weight(name=\"weight\", shape=[d, self.n_output_nodes]) # note the dimensionality\n",
344+
" self.b = self.add_weight(name=\"bias\", shape=[1, self.n_output_nodes]) # note the dimensionality\n",
345345
"\n",
346346
" def call(self, x):\n",
347347
" '''TODO: define the operation for z (hint: use tf.matmul)'''\n",

0 commit comments

Comments
 (0)