|
143 | 143 | "cell_type": "markdown",
|
144 | 144 | "metadata": {},
|
145 | 145 | "source": [
|
146 |
| - "#### Design neural network architecture" |
| 146 | + "#### Define dictionaries for storing weights and biases for each layer -- and initialize" |
147 | 147 | ]
|
148 | 148 | },
|
149 | 149 | {
|
|
154 | 154 | },
|
155 | 155 | "outputs": [],
|
156 | 156 | "source": [
|
157 |
| - "def network(x, weights, biases):\n", |
158 |
| - " \n", |
159 |
| - " # DEFINE\n", |
160 |
| - " \n", |
161 |
| - " return out_layer_z" |
| 157 | + "bias_dict = {\n", |
| 158 | + " 'b1': tf.Variable(tf.zeros([n_dense_1])), \n", |
| 159 | + " 'b2': tf.Variable(tf.zeros([n_dense_2])),\n", |
| 160 | + " 'b_out': tf.Variable(tf.zeros([n_classes]))\n", |
| 161 | + "}\n", |
| 162 | + "\n", |
| 163 | + "weight_dict = {\n", |
| 164 | + " 'W1': tf.get_variable('W1', [n_input, n_dense_1], initializer=weight_initializer),\n", |
| 165 | + " 'W2': tf.get_variable('W2', [n_dense_1, n_dense_2], initializer=weight_initializer),\n", |
| 166 | + " 'W_out': tf.get_variable('W_out', [n_dense_2, n_classes], initializer=weight_initializer)\n", |
| 167 | + "}" |
162 | 168 | ]
|
163 | 169 | },
|
164 | 170 | {
|
165 | 171 | "cell_type": "markdown",
|
166 | 172 | "metadata": {},
|
167 | 173 | "source": [
|
168 |
| - "#### Define dictionaries for storing weights and biases for each layer -- and initialize" |
| 174 | + "#### Design neural network architecture" |
169 | 175 | ]
|
170 | 176 | },
|
171 | 177 | {
|
|
176 | 182 | },
|
177 | 183 | "outputs": [],
|
178 | 184 | "source": [
|
179 |
| - "bias_dict = {\n", |
180 |
| - " 'b1': tf.Variable(tf.zeros([n_dense_1])), \n", |
181 |
| - " 'b2': tf.Variable(tf.zeros([n_dense_2])),\n", |
182 |
| - " 'b_out': tf.Variable(tf.zeros([n_classes]))\n", |
183 |
| - "}\n", |
184 |
| - "\n", |
185 |
| - "weight_dict = {\n", |
186 |
| - " 'W1': tf.get_variable('W1', [n_input, n_dense_1], initializer=weight_initializer),\n", |
187 |
| - " 'W2': tf.get_variable('W2', [n_dense_1, n_dense_2], initializer=weight_initializer),\n", |
188 |
| - " 'W_out': tf.get_variable('W_out', [n_dense_2, n_classes], initializer=weight_initializer)\n", |
189 |
| - "}" |
| 185 | + "def network(x, weights, biases):\n", |
| 186 | + " \n", |
| 187 | + " # DEFINE\n", |
| 188 | + " \n", |
| 189 | + " return out_layer_z" |
190 | 190 | ]
|
191 | 191 | },
|
192 | 192 | {
|
|
336 | 336 | "name": "python",
|
337 | 337 | "nbconvert_exporter": "python",
|
338 | 338 | "pygments_lexer": "ipython3",
|
339 |
| - "version": "3.6.1" |
| 339 | + "version": "3.6.2" |
340 | 340 | }
|
341 | 341 | },
|
342 | 342 | "nbformat": 4,
|
|
0 commit comments