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 Jan 17, 2022
1 parent b712825 commit 42a3c01
Show file tree
Hide file tree
Showing 59 changed files with 78,483 additions and 17,851 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.5428, 0.4572, 0.0000, 0.0000],\n",
" [0.3719, 0.6281, 0.0000, 0.0000]],\n",
"tensor([[[0.5301, 0.4699, 0.0000, 0.0000],\n",
" [0.5574, 0.4426, 0.0000, 0.0000]],\n",
"\n",
" [[0.3854, 0.3555, 0.2591, 0.0000],\n",
" [0.2436, 0.3236, 0.4328, 0.0000]]])"
" [[0.3333, 0.2810, 0.3857, 0.0000],\n",
" [0.3744, 0.2307, 0.3949, 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.4243, 0.2466, 0.3291, 0.0000]],\n",
" [0.3439, 0.4590, 0.1970, 0.0000]],\n",
"\n",
" [[0.4338, 0.5662, 0.0000, 0.0000],\n",
" [0.3165, 0.2913, 0.1846, 0.2076]]])"
" [[0.5145, 0.4855, 0.0000, 0.0000],\n",
" [0.1810, 0.2662, 0.2728, 0.2800]]])"
]
},
"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>2022-01-14T02:41:57.026437</dc:date>\n",
" <dc:date>2022-01-17T01:25:33.755176</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(#p53d06655b0)\">\n",
" <image height=\"23\" id=\"image4d8d697080\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
" <g clip-path=\"url(#pd65502a493)\">\n",
" <image height=\"23\" id=\"image5dbb700cae\" 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=\"m7124b261dc\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mdb790e4686\" 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=\"#m7124b261dc\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#mdb790e4686\" 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=\"#m7124b261dc\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#mdb790e4686\" 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=\"mcc97a17a1c\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mb1cb9d5c90\" 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=\"#mcc97a17a1c\" y=\"42.39\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mb1cb9d5c90\" 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=\"#mcc97a17a1c\" y=\"53.55\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mb1cb9d5c90\" 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(#p2c781f54ac)\" d=\"M 152.815625 88.74 \n",
" <path clip-path=\"url(#p2ba53be6eb)\" 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=\"image7594854099\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
" <image height=\"82\" id=\"image3323dc4856\" 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=\"m45d7bb62c5\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"m9814312d07\" 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=\"#m45d7bb62c5\" y=\"88.74\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#m9814312d07\" 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=\"#m45d7bb62c5\" y=\"56.124\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#m9814312d07\" 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=\"#m45d7bb62c5\" y=\"23.508\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#m9814312d07\" 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=\"p53d06655b0\">\n",
" <clipPath id=\"pd65502a493\">\n",
" <rect height=\"22.32\" width=\"111.6\" x=\"34.240625\" y=\"36.81\"/>\n",
" </clipPath>\n",
" <clipPath id=\"p2c781f54ac\">\n",
" <clipPath id=\"p2ba53be6eb\">\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>2022-01-14T02:41:57.200621</dc:date>\n",
" <dc:date>2022-01-17T01:25:33.937157</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(#p40cd2fa09d)\">\n",
" <image height=\"23\" id=\"image723e1e1618\" transform=\"scale(1 -1)translate(0 -23)\" width=\"112\" x=\"34.240625\" xlink:href=\"data:image/png;base64,\n",
" <g clip-path=\"url(#pfb215bd22c)\">\n",
" <image height=\"23\" id=\"image560948f1a3\" 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=\"m5ba57490c9\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"m3ec6d1045a\" 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=\"#m5ba57490c9\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"39.820625\" xlink:href=\"#m3ec6d1045a\" 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=\"#m5ba57490c9\" y=\"59.13\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"95.620625\" xlink:href=\"#m3ec6d1045a\" 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=\"m0eb6e22df9\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"mfd1a83efee\" 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=\"#m0eb6e22df9\" y=\"42.39\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mfd1a83efee\" 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=\"#m0eb6e22df9\" y=\"53.55\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.240625\" xlink:href=\"#mfd1a83efee\" 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(#p75ef33c45e)\" d=\"M 152.815625 88.74 \n",
" <path clip-path=\"url(#p4bf7389d1a)\" 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=\"imagef7231d510c\" transform=\"scale(1 -1)translate(0 -82)\" width=\"4\" x=\"153\" xlink:href=\"data:image/png;base64,\n",
" <image height=\"82\" id=\"imagea7ca956c1a\" 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=\"m3fd4852cce\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
"\" id=\"me36aa722bf\" 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=\"#m3fd4852cce\" y=\"88.74\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#me36aa722bf\" 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=\"#m3fd4852cce\" y=\"56.124\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#me36aa722bf\" 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=\"#m3fd4852cce\" y=\"23.508\"/>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"156.892625\" xlink:href=\"#me36aa722bf\" 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=\"p40cd2fa09d\">\n",
" <clipPath id=\"pfb215bd22c\">\n",
" <rect height=\"22.32\" width=\"111.6\" x=\"34.240625\" y=\"36.81\"/>\n",
" </clipPath>\n",
" <clipPath id=\"p75ef33c45e\">\n",
" <clipPath id=\"p4bf7389d1a\">\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 42a3c01

Please sign in to comment.