Skip to content

Commit 959dd37

Browse files
authored
Update Exercise_04_2_solution.ipynb
fix solution
1 parent b8f8738 commit 959dd37

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Exercise_04_2_solution.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
" def __init__(self, units=1, input_dim=1): # when intializing the layer the weights have to be initialized\n",
8989
" super(LinearLayer, self).__init__()\n",
9090
" w_init = tf.random_normal_initializer()\n",
91-
" self.w = tf.Variable(initial_value=w_init(shape=(input_dim, units), dtype=\"float32\"),\n",
92-
" trainable=True)\n",
91+
" self.w = self.add_weight(shape=(input_dim, units), initializer=w_init\n",
92+
" trainable=True)\n",
9393
"\n",
9494
" def call(self, inputs): # when calling the layer the linear transformation has to be performed\n",
9595
" return tf.matmul(inputs, self.w)"

0 commit comments

Comments
 (0)