From ed0ece351bdd9486557ac0278d02959fffc627c9 Mon Sep 17 00:00:00 2001 From: romaingallo <beromrousse@gmail.com> Date: Mon, 18 Nov 2024 20:24:55 +0100 Subject: [PATCH] PyTorch install and test Nothing more, except a useless description... --- TD2 Deep Learning.ipynb | 79 +++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/TD2 Deep Learning.ipynb b/TD2 Deep Learning.ipynb index 00e4fdc..a14730c 100644 --- a/TD2 Deep Learning.ipynb +++ b/TD2 Deep Learning.ipynb @@ -33,12 +33,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "330a42f5", "metadata": {}, "outputs": [], "source": [ - "%pip install torch torchvision" + "# ! pip install torch torchvision" ] }, { @@ -52,10 +52,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "b1950f0a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "tensor([[ 0.5683, 0.1804, 1.4743, 0.6624, -0.3736, -0.4592, 0.4064, -0.9675,\n", + " -0.4277, -0.2650],\n", + " [ 0.6056, -0.3486, -1.9553, 0.4105, 0.7670, 0.4662, 0.5283, -0.0456,\n", + " 1.8780, 0.4968],\n", + " [ 0.8474, -0.4548, 0.2919, 0.2475, 1.4503, 0.6661, 1.7254, 0.8893,\n", + " 0.3085, -0.0221],\n", + " [ 0.6990, 0.1521, -1.2816, 2.6347, 0.1262, -0.7044, -0.8741, -0.6162,\n", + " -0.7049, -1.2797],\n", + " [-0.6189, 0.4569, -1.1453, -0.8152, -0.1246, -0.4752, 0.0846, -0.5256,\n", + " -0.0601, 1.3087],\n", + " [-0.2480, -1.2089, 0.2249, -0.1609, -0.4504, -0.3741, -0.3146, 0.3680,\n", + " -0.4713, -1.4470],\n", + " [-0.2880, -2.3141, 0.6689, 0.0861, 0.2228, 0.8982, -1.0881, 2.7190,\n", + " -0.2674, -0.1549],\n", + " [-0.7673, 1.8817, 0.6502, 1.1123, -0.1254, -0.6640, 1.9256, 0.0474,\n", + " 0.0234, 0.3481],\n", + " [ 0.7740, -0.7716, -0.1533, -2.0054, -0.5630, 0.3676, -0.3526, 0.0617,\n", + " 1.9769, -0.7285],\n", + " [ 1.3182, -0.2133, 1.3239, 0.4849, 0.3648, 0.2810, 0.1524, 0.5622,\n", + " -0.2488, -0.2631],\n", + " [-0.6537, 1.8060, -0.0440, -1.2116, 1.8237, 0.5003, 0.8180, -1.3485,\n", + " -0.2016, 0.1752],\n", + " [-1.4367, 0.8463, -0.6323, -2.0651, 0.5008, -0.4669, 1.2121, 1.3548,\n", + " -0.6097, 0.1014],\n", + " [-0.8016, -1.0746, 0.7798, 2.7186, 0.5087, 1.8546, -0.9003, 0.6299,\n", + " -0.4445, 1.5645],\n", + " [-1.2421, -0.7729, 0.2683, 0.1155, -0.6617, -0.0157, 0.7872, 0.5142,\n", + " 1.0696, 1.4580]])\n", + "AlexNet(\n", + " (features): Sequential(\n", + " (0): Conv2d(3, 64, kernel_size=(11, 11), stride=(4, 4), padding=(2, 2))\n", + " (1): ReLU(inplace=True)\n", + " (2): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " (3): Conv2d(64, 192, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))\n", + " (4): ReLU(inplace=True)\n", + " (5): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " (6): Conv2d(192, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (7): ReLU(inplace=True)\n", + " (8): Conv2d(384, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (9): ReLU(inplace=True)\n", + " (10): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (11): ReLU(inplace=True)\n", + " (12): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " )\n", + " (avgpool): AdaptiveAvgPool2d(output_size=(6, 6))\n", + " (classifier): Sequential(\n", + " (0): Dropout(p=0.5, inplace=False)\n", + " (1): Linear(in_features=9216, out_features=4096, bias=True)\n", + " (2): ReLU(inplace=True)\n", + " (3): Dropout(p=0.5, inplace=False)\n", + " (4): Linear(in_features=4096, out_features=4096, bias=True)\n", + " (5): ReLU(inplace=True)\n", + " (6): Linear(in_features=4096, out_features=1000, bias=True)\n", + " )\n", + ")\n" + ] + } + ], "source": [ "import torch\n", "\n", @@ -926,7 +988,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.5 ('base')", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -940,12 +1002,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" - }, - "vscode": { - "interpreter": { - "hash": "9e3efbebb05da2d4a1968abe9a0645745f54b63feb7a85a514e4da0495be97eb" - } + "version": "3.11.9" } }, "nbformat": 4, -- GitLab