|
60 | 60 | },
|
61 | 61 | {
|
62 | 62 | "cell_type": "code",
|
63 |
| - "execution_count": null, |
| 63 | + "execution_count": 4, |
64 | 64 | "metadata": {},
|
65 | 65 | "outputs": [],
|
66 | 66 | "source": [
|
|
70 | 70 | },
|
71 | 71 | {
|
72 | 72 | "cell_type": "code",
|
73 |
| - "execution_count": null, |
| 73 | + "execution_count": 5, |
74 | 74 | "metadata": {},
|
75 | 75 | "outputs": [],
|
76 | 76 | "source": [
|
|
86 | 86 | },
|
87 | 87 | {
|
88 | 88 | "cell_type": "code",
|
89 |
| - "execution_count": null, |
| 89 | + "execution_count": 7, |
90 | 90 | "metadata": {},
|
91 | 91 | "outputs": [],
|
92 | 92 | "source": [
|
|
119 | 119 | },
|
120 | 120 | {
|
121 | 121 | "cell_type": "code",
|
122 |
| - "execution_count": null, |
| 122 | + "execution_count": 16, |
123 | 123 | "metadata": {},
|
124 |
| - "outputs": [], |
| 124 | + "outputs": [ |
| 125 | + { |
| 126 | + "data": { |
| 127 | + "text/plain": [ |
| 128 | + "tensor([[0.1595]])" |
| 129 | + ] |
| 130 | + }, |
| 131 | + "execution_count": 16, |
| 132 | + "metadata": {}, |
| 133 | + "output_type": "execute_result" |
| 134 | + } |
| 135 | + ], |
125 | 136 | "source": [
|
126 |
| - "## Calculate the output of this network using the weights and bias tensors" |
| 137 | + "## Calculate the output of this network using the weights and bias tensors\n", |
| 138 | + "\n", |
| 139 | + "activation((features*weights).sum() + bias)" |
127 | 140 | ]
|
128 | 141 | },
|
129 | 142 | {
|
|
162 | 175 | },
|
163 | 176 | {
|
164 | 177 | "cell_type": "code",
|
165 |
| - "execution_count": null, |
| 178 | + "execution_count": 31, |
166 | 179 | "metadata": {},
|
167 |
| - "outputs": [], |
| 180 | + "outputs": [ |
| 181 | + { |
| 182 | + "data": { |
| 183 | + "text/plain": [ |
| 184 | + "tensor([[0.1595]])" |
| 185 | + ] |
| 186 | + }, |
| 187 | + "execution_count": 31, |
| 188 | + "metadata": {}, |
| 189 | + "output_type": "execute_result" |
| 190 | + } |
| 191 | + ], |
168 | 192 | "source": [
|
169 |
| - "## Calculate the output of this network using matrix multiplication" |
| 193 | + "## Calculate the output of this network using matrix multiplication\n", |
| 194 | + "\n", |
| 195 | + "activation(torch.mm(features, weights.view(5,1)) + bias)" |
170 | 196 | ]
|
171 | 197 | },
|
172 | 198 | {
|
|
204 | 230 | },
|
205 | 231 | {
|
206 | 232 | "cell_type": "code",
|
207 |
| - "execution_count": null, |
| 233 | + "execution_count": 46, |
208 | 234 | "metadata": {},
|
209 | 235 | "outputs": [],
|
210 | 236 | "source": [
|
|
238 | 264 | },
|
239 | 265 | {
|
240 | 266 | "cell_type": "code",
|
241 |
| - "execution_count": null, |
| 267 | + "execution_count": 47, |
242 | 268 | "metadata": {},
|
243 |
| - "outputs": [], |
| 269 | + "outputs": [ |
| 270 | + { |
| 271 | + "data": { |
| 272 | + "text/plain": [ |
| 273 | + "tensor([[0.3171]])" |
| 274 | + ] |
| 275 | + }, |
| 276 | + "execution_count": 47, |
| 277 | + "metadata": {}, |
| 278 | + "output_type": "execute_result" |
| 279 | + } |
| 280 | + ], |
244 | 281 | "source": [
|
245 |
| - "## Your solution here" |
| 282 | + "## Your solution here\n", |
| 283 | + "\n", |
| 284 | + "H = activation(torch.mm(features, W1) + B1)\n", |
| 285 | + "activation(torch.mm(H, W2) + B2)" |
246 | 286 | ]
|
247 | 287 | },
|
248 | 288 | {
|
|
325 | 365 | ],
|
326 | 366 | "metadata": {
|
327 | 367 | "kernelspec": {
|
328 |
| - "display_name": "Python 3", |
| 368 | + "display_name": "Python 3 (ipykernel)", |
329 | 369 | "language": "python",
|
330 | 370 | "name": "python3"
|
331 | 371 | },
|
|
339 | 379 | "name": "python",
|
340 | 380 | "nbconvert_exporter": "python",
|
341 | 381 | "pygments_lexer": "ipython3",
|
342 |
| - "version": "3.6.6" |
| 382 | + "version": "3.8.10" |
343 | 383 | }
|
344 | 384 | },
|
345 | 385 | "nbformat": 4,
|
|
0 commit comments