From b8133346a4a626451436883f35477c8014de4a4b Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Tue, 24 Aug 2021 20:27:14 -0500 Subject: [PATCH] Add latest code --- fashion-mnist-with-pytorch-93-accuracy.ipynb | 34 ++++++----------- nn_tutorial.ipynb | 25 +++++++++++-- quickstart_tutorial.ipynb | 39 +++++++++++++------- 3 files changed, 58 insertions(+), 40 deletions(-) diff --git a/fashion-mnist-with-pytorch-93-accuracy.ipynb b/fashion-mnist-with-pytorch-93-accuracy.ipynb index 79f6923..5f98a1f 100644 --- a/fashion-mnist-with-pytorch-93-accuracy.ipynb +++ b/fashion-mnist-with-pytorch-93-accuracy.ipynb @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 1, "metadata": { "colab": {}, "colab_type": "code", @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": { "colab": {}, "colab_type": "code", @@ -219,22 +219,13 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "metadata": { "colab": {}, "colab_type": "code", "id": "zM618_wYGM0n" }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/ta180m/git/PyTorch/.venv/lib/python3.9/site-packages/torchvision/datasets/mnist.py:498: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:180.)\n", - " return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)\n" - ] - } - ], + "outputs": [], "source": [ "\n", "train_set = torchvision.datasets.FashionMNIST(\"./data\", download=True, transform=\n", @@ -246,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": { "colab": {}, "colab_type": "code", @@ -279,7 +270,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 6, "metadata": { "colab": {}, "colab_type": "code", @@ -415,7 +406,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -427,11 +418,10 @@ }, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - " \n", - "torch.Size([10, 1, 28, 28]) torch.Size([10])\n" + " \ntorch.Size([10, 1, 28, 28]) torch.Size([10])\n" ] } ], @@ -525,7 +515,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 8, "metadata": { "colab": {}, "colab_type": "code", @@ -998,9 +988,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.9.6-final" } }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/nn_tutorial.ipynb b/nn_tutorial.ipynb index 93ad239..de69b3c 100644 --- a/nn_tutorial.ipynb +++ b/nn_tutorial.ipynb @@ -67,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": { "collapsed": false, "jupyter": { @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "metadata": { "collapsed": false, "jupyter": { @@ -119,6 +119,23 @@ " ((x_train, y_train), (x_valid, y_valid), _) = pickle.load(f, encoding=\"latin-1\")" ] }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[[0. 0. 0. ... 0. 0. 0.]\n [0. 0. 0. ... 0. 0. 0.]\n [0. 0. 0. ... 0. 0. 0.]\n ...\n [0. 0. 0. ... 0. 0. 0.]\n [0. 0. 0. ... 0. 0. 0.]\n [0. 0. 0. ... 0. 0. 0.]]\n" + ] + } + ], + "source": [ + "print(x_valid)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1920,9 +1937,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.9.6-final" } }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/quickstart_tutorial.ipynb b/quickstart_tutorial.ipynb index 4e847d9..f2ba6c8 100644 --- a/quickstart_tutorial.ipynb +++ b/quickstart_tutorial.ipynb @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": { "collapsed": false, "jupyter": { @@ -79,23 +79,14 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": { "collapsed": false, "jupyter": { "outputs_hidden": false } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/ta180m/git/PyTorch/.venv/lib/python3.9/site-packages/torchvision/datasets/mnist.py:498: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:180.)\n", - " return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)\n" - ] - } - ], + "outputs": [], "source": [ "# Download training data from open datasets.\n", "training_data = datasets.FashionMNIST(\n", @@ -124,6 +115,26 @@ "\n" ] }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "torchvision.datasets.mnist.FashionMNIST" + ] + }, + "metadata": {}, + "execution_count": 6 + } + ], + "source": [ + "type(training_data)" + ] + }, { "cell_type": "code", "execution_count": 23, @@ -770,9 +781,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.9.6-final" } }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file