Add latest code

This commit is contained in:
Anthony Wang 2021-08-24 20:27:14 -05:00
parent 8816c54f44
commit b8133346a4
3 changed files with 58 additions and 40 deletions

View file

@ -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": [
"<class 'torch.Tensor'> <class 'torch.Tensor'>\n",
"torch.Size([10, 1, 28, 28]) torch.Size([10])\n"
"<class 'torch.Tensor'> <class 'torch.Tensor'>\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
}
}

View file

@ -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
}
}

View file

@ -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
}
}