Skip to content

Commit

Permalink
Version 2.0.0-beta0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mu Li committed Dec 9, 2021
1 parent 6b4d8c4 commit f0d8626
Show file tree
Hide file tree
Showing 59 changed files with 17,131 additions and 76,981 deletions.
82 changes: 41 additions & 41 deletions chapter_attention-mechanisms/attention-scoring-functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
{
"data": {
"text/plain": [
"tensor([[[0.4035, 0.5965, 0.0000, 0.0000],\n",
" [0.6398, 0.3602, 0.0000, 0.0000]],\n",
"tensor([[[0.5861, 0.4139, 0.0000, 0.0000],\n",
" [0.4642, 0.5358, 0.0000, 0.0000]],\n",
"\n",
" [[0.3329, 0.3539, 0.3132, 0.0000],\n",
" [0.2669, 0.4561, 0.2770, 0.0000]]])"
" [[0.3816, 0.3217, 0.2967, 0.0000],\n",
" [0.3886, 0.2956, 0.3158, 0.0000]]])"
]
},
"execution_count": 3,
Expand All @@ -120,10 +120,10 @@
"data": {
"text/plain": [
"tensor([[[1.0000, 0.0000, 0.0000, 0.0000],\n",
" [0.3051, 0.4119, 0.2831, 0.0000]],\n",
" [0.3508, 0.4129, 0.2363, 0.0000]],\n",
"\n",
" [[0.2945, 0.7055, 0.0000, 0.0000],\n",
" [0.1808, 0.3565, 0.2737, 0.1889]]])"
" [[0.6064, 0.3936, 0.0000, 0.0000],\n",
" [0.1593, 0.2755, 0.3813, 0.1839]]])"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -254,7 +254,7 @@
" <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
" <cc:Work>\n",
" <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
" <dc:date>2021-12-08T14:46:51.865619</dc:date>\n",
" <dc:date>2021-12-09T00:37:24.619212</dc:date>\n",
" <dc:format>image/svg+xml</dc:format>\n",
" <dc:creator>\n",
" <cc:Agent>\n",
Expand Down Expand Up @@ -285,8 +285,8 @@
"z\n",
"\" style=\"fill:#ffffff;\"/>\n",
" </g>\n",
" <g clip-path=\"url(#p137379d366)\">\n",
" <image height=\"23\" id=\"image182755f1a9\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
" <g clip-path=\"url(#pa6f4d7ce10)\">\n",
" <image height=\"23\" id=\"imaged152317eb8\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
"iVBORw0KGgoAAAANSUhEUgAAAHAAAAAXCAYAAADTEcupAAAAeElEQVR4nO3YsQmAQBAF0X+aWp8tGFqDXZjZnC2YCV5uJnIcA/MKWBaGTbbcx/ZESZJxXnuv8NnQewH9Y0A4A8IZEM6AcAaEMyCcAeEMCGdAOAPClSVTk1/ofp0txurFC4QzIJwB4QwIZ0A4A8IZEM6AcAaEMyBcBc2IB/NA+hblAAAAAElFTkSuQmCC\" y=\"-36.13\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
Expand All @@ -295,10 +295,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" id=\"mfb04616ccb\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mf7a3df9360\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#mfb04616ccb\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#mf7a3df9360\" y=\"59.13\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
Expand Down Expand Up @@ -334,7 +334,7 @@
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#mfb04616ccb\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#mf7a3df9360\" y=\"59.13\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
Expand Down Expand Up @@ -472,10 +472,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" id=\"m36783e5ca5\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"m999b9d655d\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m36783e5ca5\" y=\"42.39\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m999b9d655d\" y=\"42.39\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
Expand All @@ -488,7 +488,7 @@
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m36783e5ca5\" y=\"53.55\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m999b9d655d\" y=\"53.55\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
Expand Down Expand Up @@ -625,7 +625,7 @@
" </g>\n",
" <g id=\"axes_2\">\n",
" <g id=\"patch_7\">\n",
" <path clip-path=\"url(#pda607964fe)\" d=\"M 152.815625 88.74 \n",
" <path clip-path=\"url(#pe161e89456)\" d=\"M 152.815625 88.74 \n",
"L 152.815625 88.421484 \n",
"L 152.815625 7.518516 \n",
"L 152.815625 7.2 \n",
Expand All @@ -636,7 +636,7 @@
"z\n",
"\" style=\"fill:#ffffff;stroke:#ffffff;stroke-linejoin:miter;stroke-width:0.01;\"/>\n",
" </g>\n",
" <image height=\"82\" id=\"image95029f5390\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
" <image height=\"82\" id=\"image90e06f3988\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
"iVBORw0KGgoAAAANSUhEUgAAAAQAAABSCAYAAABzJnWUAAAAnklEQVR4nJ2SOw5CMQwEjfTuf1QqChT/aMnskwxJl9F414ry6Nez7etclmE7qCLIAfRonABZLBy1o2FJEBzxxdD/M7R2NFh7EzpmHBhSm3z1H/YAaDEk1OfVBfCPCXCAEmPJppJRg1Fs0QyCYGhmw4jRIMjkSMgIjBBDapvGfrcrTYwDYINxsweAM8NpvAtgCeDIYqiMSIsYUrs/sdkHBN7KuQYqCJAAAAAASUVORK5CYII=\" y=\"-6\"/>\n",
" <g id=\"matplotlib.axis_3\"/>\n",
" <g id=\"matplotlib.axis_4\">\n",
Expand All @@ -645,10 +645,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L 3.5 0 \n",
"\" id=\"md55d85d8cd\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mcc841c382f\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#md55d85d8cd\" y=\"88.74\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcc841c382f\" y=\"88.74\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
Expand All @@ -671,7 +671,7 @@
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_6\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#md55d85d8cd\" y=\"56.124\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcc841c382f\" y=\"56.124\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
Expand Down Expand Up @@ -712,7 +712,7 @@
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#md55d85d8cd\" y=\"23.508\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcc841c382f\" y=\"23.508\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
Expand Down Expand Up @@ -759,10 +759,10 @@
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"p137379d366\">\n",
" <clipPath id=\"pa6f4d7ce10\">\n",
" <rect height=\"22.32\" width=\"111.6\" x=\"34.240625\" y=\"36.81\"/>\n",
" </clipPath>\n",
" <clipPath id=\"pda607964fe\">\n",
" <clipPath id=\"pe161e89456\">\n",
" <rect height=\"81.54\" width=\"4.077\" x=\"152.815625\" y=\"7.2\"/>\n",
" </clipPath>\n",
" </defs>\n",
Expand Down Expand Up @@ -892,7 +892,7 @@
" <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
" <cc:Work>\n",
" <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
" <dc:date>2021-12-08T14:46:52.040752</dc:date>\n",
" <dc:date>2021-12-09T00:37:24.835373</dc:date>\n",
" <dc:format>image/svg+xml</dc:format>\n",
" <dc:creator>\n",
" <cc:Agent>\n",
Expand Down Expand Up @@ -923,8 +923,8 @@
"z\n",
"\" style=\"fill:#ffffff;\"/>\n",
" </g>\n",
" <g clip-path=\"url(#p7ff5d89ebf)\">\n",
" <image height=\"23\" id=\"image70ef7d02b8\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
" <g clip-path=\"url(#p8e351ca50d)\">\n",
" <image height=\"23\" id=\"imaged7b5271678\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
"iVBORw0KGgoAAAANSUhEUgAAAHAAAAAXCAYAAADTEcupAAAAeElEQVR4nO3YsQmAQBAF0X+aWp8tGFqDXZjZnC2YCV5uJnIcA/MKWBaGTbbcx/ZESZJxXnuv8NnQewH9Y0A4A8IZEM6AcAaEMyCcAeEMCGdAOAPClSVTk1/ofp0txurFC4QzIJwB4QwIZ0A4A8IZEM6AcAaEMyBcBc2IB/NA+hblAAAAAElFTkSuQmCC\" y=\"-36.13\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
Expand All @@ -933,10 +933,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" id=\"m96546a7bd1\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"me242945b1d\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#m96546a7bd1\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#me242945b1d\" y=\"59.13\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
Expand Down Expand Up @@ -972,7 +972,7 @@
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#m96546a7bd1\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#me242945b1d\" y=\"59.13\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
Expand Down Expand Up @@ -1110,10 +1110,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" id=\"m1a5b6948c1\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mcc74a0fe0f\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m1a5b6948c1\" y=\"42.39\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mcc74a0fe0f\" y=\"42.39\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
Expand All @@ -1126,7 +1126,7 @@
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#m1a5b6948c1\" y=\"53.55\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mcc74a0fe0f\" y=\"53.55\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
Expand Down Expand Up @@ -1263,7 +1263,7 @@
" </g>\n",
" <g id=\"axes_2\">\n",
" <g id=\"patch_7\">\n",
" <path clip-path=\"url(#p5320ebaff1)\" d=\"M 152.815625 88.74 \n",
" <path clip-path=\"url(#pfa01528545)\" d=\"M 152.815625 88.74 \n",
"L 152.815625 88.421484 \n",
"L 152.815625 7.518516 \n",
"L 152.815625 7.2 \n",
Expand All @@ -1274,7 +1274,7 @@
"z\n",
"\" style=\"fill:#ffffff;stroke:#ffffff;stroke-linejoin:miter;stroke-width:0.01;\"/>\n",
" </g>\n",
" <image height=\"82\" id=\"image8822b4bce1\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
" <image height=\"82\" id=\"image708b1cb45f\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
"iVBORw0KGgoAAAANSUhEUgAAAAQAAABSCAYAAABzJnWUAAAAnklEQVR4nJ2SOw5CMQwEjfTuf1QqChT/aMnskwxJl9F414ry6Nez7etclmE7qCLIAfRonABZLBy1o2FJEBzxxdD/M7R2NFh7EzpmHBhSm3z1H/YAaDEk1OfVBfCPCXCAEmPJppJRg1Fs0QyCYGhmw4jRIMjkSMgIjBBDapvGfrcrTYwDYINxsweAM8NpvAtgCeDIYqiMSIsYUrs/sdkHBN7KuQYqCJAAAAAASUVORK5CYII=\" y=\"-6\"/>\n",
" <g id=\"matplotlib.axis_3\"/>\n",
" <g id=\"matplotlib.axis_4\">\n",
Expand All @@ -1283,10 +1283,10 @@
" <defs>\n",
" <path d=\"M 0 0 \n",
"L 3.5 0 \n",
"\" id=\"mcbb3b5b5a0\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mbaecdd5199\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcbb3b5b5a0\" y=\"88.74\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mbaecdd5199\" y=\"88.74\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
Expand All @@ -1309,7 +1309,7 @@
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_6\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcbb3b5b5a0\" y=\"56.124\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mbaecdd5199\" y=\"56.124\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
Expand Down Expand Up @@ -1350,7 +1350,7 @@
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mcbb3b5b5a0\" y=\"23.508\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#mbaecdd5199\" y=\"23.508\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
Expand Down Expand Up @@ -1397,10 +1397,10 @@
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"p7ff5d89ebf\">\n",
" <clipPath id=\"p8e351ca50d\">\n",
" <rect height=\"22.32\" width=\"111.6\" x=\"34.240625\" y=\"36.81\"/>\n",
" </clipPath>\n",
" <clipPath id=\"p5320ebaff1\">\n",
" <clipPath id=\"pfa01528545\">\n",
" <rect height=\"81.54\" width=\"4.077\" x=\"152.815625\" y=\"7.2\"/>\n",
" </clipPath>\n",
" </defs>\n",
Expand Down
Loading

0 comments on commit f0d8626

Please sign in to comment.