Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
9bow committed Mar 27, 2022
1 parent 7fb5294 commit db48b10
Show file tree
Hide file tree
Showing 206 changed files with 1,547 additions and 1,447 deletions.
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d3c78aee0796eaca17b472b08560486c
config: 85edaa44f46a784d15b287d6d8ea99db
tags: 645f666f9bcd5a90fca523b33c5a78b7

Large diffs are not rendered by default.

395 changes: 196 additions & 199 deletions docs/_downloads/934f425a64afc04a1466c778c945fb84/mario_rl_tutorial.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"outputs": [],
"source": [
"# \ubaa8\ub378\uc5d0 \ub300\ud55c \uc785\ub825\uac12\nx = torch.randn(batch_size, 1, 224, 224, requires_grad=True)\ntorch_out = torch_model(x)\n\n# \ubaa8\ub378 \ubcc0\ud658\ntorch.onnx.export(torch_model, # \uc2e4\ud589\ub420 \ubaa8\ub378\n x, # \ubaa8\ub378 \uc785\ub825\uac12 (\ud29c\ud50c \ub610\ub294 \uc5ec\ub7ec \uc785\ub825\uac12\ub4e4\ub3c4 \uac00\ub2a5)\n \"super_resolution.onnx\", # \ubaa8\ub378 \uc800\uc7a5 \uacbd\ub85c (\ud30c\uc77c \ub610\ub294 \ud30c\uc77c\uacfc \uc720\uc0ac\ud55c \uac1d\uccb4 \ubaa8\ub450 \uac00\ub2a5)\n export_params=True, # \ubaa8\ub378 \ud30c\uc77c \uc548\uc5d0 \ud559\uc2b5\ub41c \ubaa8\ub378 \uac00\uc911\uce58\ub97c \uc800\uc7a5\ud560\uc9c0\uc758 \uc5ec\ubd80\n opset_version=10, # \ubaa8\ub378\uc744 \ubcc0\ud658\ud560 \ub54c \uc0ac\uc6a9\ud560 ONNX \ubc84\uc804\n do_constant_folding=True, # \ucd5c\uc801\ud558\uc2dc \uc0c1\uc218\ud3f4\ub529\uc744 \uc0ac\uc6a9\ud560\uc9c0\uc758 \uc5ec\ubd80\n input_names = ['input'], # \ubaa8\ub378\uc758 \uc785\ub825\uac12\uc744 \uac00\ub9ac\ud0a4\ub294 \uc774\ub984\n output_names = ['output'], # \ubaa8\ub378\uc758 \ucd9c\ub825\uac12\uc744 \uac00\ub9ac\ud0a4\ub294 \uc774\ub984\n dynamic_axes={'input' : {0 : 'batch_size'}, # \uac00\ubcc0\uc801\uc778 \uae38\uc774\ub97c \uac00\uc9c4 \ucc28\uc6d0\n 'output' : {0 : 'batch_size'}})"
"# \ubaa8\ub378\uc5d0 \ub300\ud55c \uc785\ub825\uac12\nx = torch.randn(batch_size, 1, 224, 224, requires_grad=True)\ntorch_out = torch_model(x)\n\n# \ubaa8\ub378 \ubcc0\ud658\ntorch.onnx.export(torch_model, # \uc2e4\ud589\ub420 \ubaa8\ub378\n x, # \ubaa8\ub378 \uc785\ub825\uac12 (\ud29c\ud50c \ub610\ub294 \uc5ec\ub7ec \uc785\ub825\uac12\ub4e4\ub3c4 \uac00\ub2a5)\n \"super_resolution.onnx\", # \ubaa8\ub378 \uc800\uc7a5 \uacbd\ub85c (\ud30c\uc77c \ub610\ub294 \ud30c\uc77c\uacfc \uc720\uc0ac\ud55c \uac1d\uccb4 \ubaa8\ub450 \uac00\ub2a5)\n export_params=True, # \ubaa8\ub378 \ud30c\uc77c \uc548\uc5d0 \ud559\uc2b5\ub41c \ubaa8\ub378 \uac00\uc911\uce58\ub97c \uc800\uc7a5\ud560\uc9c0\uc758 \uc5ec\ubd80\n opset_version=10, # \ubaa8\ub378\uc744 \ubcc0\ud658\ud560 \ub54c \uc0ac\uc6a9\ud560 ONNX \ubc84\uc804\n do_constant_folding=True, # \ucd5c\uc801\ud654\uc2dc \uc0c1\uc218\ud3f4\ub529\uc744 \uc0ac\uc6a9\ud560\uc9c0\uc758 \uc5ec\ubd80\n input_names = ['input'], # \ubaa8\ub378\uc758 \uc785\ub825\uac12\uc744 \uac00\ub9ac\ud0a4\ub294 \uc774\ub984\n output_names = ['output'], # \ubaa8\ub378\uc758 \ucd9c\ub825\uac12\uc744 \uac00\ub9ac\ud0a4\ub294 \uc774\ub984\n dynamic_axes={'input' : {0 : 'batch_size'}, # \uac00\ubcc0\uc801\uc778 \uae38\uc774\ub97c \uac00\uc9c4 \ucc28\uc6d0\n 'output' : {0 : 'batch_size'}})"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _initialize_weights(self):
"super_resolution.onnx", # ๋ชจ๋ธ ์ €์žฅ ๊ฒฝ๋กœ (ํŒŒ์ผ ๋˜๋Š” ํŒŒ์ผ๊ณผ ์œ ์‚ฌํ•œ ๊ฐ์ฒด ๋ชจ๋‘ ๊ฐ€๋Šฅ)
export_params=True, # ๋ชจ๋ธ ํŒŒ์ผ ์•ˆ์— ํ•™์Šต๋œ ๋ชจ๋ธ ๊ฐ€์ค‘์น˜๋ฅผ ์ €์žฅํ• ์ง€์˜ ์—ฌ๋ถ€
opset_version=10, # ๋ชจ๋ธ์„ ๋ณ€ํ™˜ํ•  ๋•Œ ์‚ฌ์šฉํ•  ONNX ๋ฒ„์ „
do_constant_folding=True, # ์ตœ์ ํ•˜์‹œ ์ƒ์ˆ˜ํด๋”ฉ์„ ์‚ฌ์šฉํ• ์ง€์˜ ์—ฌ๋ถ€
do_constant_folding=True, # ์ตœ์ ํ™”์‹œ ์ƒ์ˆ˜ํด๋”ฉ์„ ์‚ฌ์šฉํ• ์ง€์˜ ์—ฌ๋ถ€
input_names = ['input'], # ๋ชจ๋ธ์˜ ์ž…๋ ฅ๊ฐ’์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ด๋ฆ„
output_names = ['output'], # ๋ชจ๋ธ์˜ ์ถœ๋ ฅ๊ฐ’์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ด๋ฆ„
dynamic_axes={'input' : {0 : 'batch_size'}, # ๊ฐ€๋ณ€์ ์ธ ๊ธธ์ด๋ฅผ ๊ฐ€์ง„ ์ฐจ์›
Expand Down
Binary file modified docs/_images/sphx_glr_mario_rl_tutorial_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@
.. customcalloutitem::
:header: (๋น„๊ณต์‹) ํ•œ๊ตญ์–ด ํŠœํ† ๋ฆฌ์–ผ ์ €์žฅ์†Œ(GitHub)
:description: GitHub์—์„œ (๋น„๊ณต์‹) ํ•œ๊ตญ์–ด ํŠœํ† ๋ฆฌ์–ผ์„ ๋งŒ๋‚˜๋ณด์„ธ์š”.
:button_link: https://github.com/9bow/PyTorch-tutorials-kr
:button_link: https://github.com/PyTorchKorea/tutorials-kr
:button_text: Go To GitHub

.. customcalloutitem::
Expand Down
4 changes: 4 additions & 0 deletions docs/_static/check-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/_static/clipboard.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_static/copy-button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 45 additions & 19 deletions docs/_static/copybutton.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
/* Copy buttons */
a.copybtn {
button.copybtn {
position: absolute;
top: .2em;
right: .2em;
width: 1em;
height: 1em;
opacity: .3;
transition: opacity 0.5s;
border: none;
display: flex;
top: .3em;
right: .3em;
width: 1.7em;
height: 1.7em;
opacity: 0;
transition: opacity 0.3s, border .3s, background-color .3s;
user-select: none;
padding: 0;
border: none;
outline: none;
border-radius: 0.4em;
/* The colors that GitHub uses */
border: #1b1f2426 1px solid;
background-color: #f6f8fa;
color: #57606a;
}

button.copybtn.success {
border-color: #22863a;
color: #22863a;
}

button.copybtn svg {
stroke: currentColor;
width: 1.5em;
height: 1.5em;
padding: 0.1em;
}

div.highlight {
position: relative;
}

a.copybtn > img {
vertical-align: top;
margin: 0;
top: 0;
left: 0;
position: absolute;
.highlight:hover button.copybtn {
opacity: 1;
}

.highlight:hover .copybtn {
opacity: 1;
.highlight button.copybtn:hover {
background-color: rgb(235, 235, 235);
}

.highlight button.copybtn:active {
background-color: rgb(187, 187, 187);
}

/**
Expand All @@ -44,11 +64,10 @@ a.copybtn > img {
visibility: hidden;
position: absolute;
content: attr(data-tooltip);
padding: 2px;
top: 0;
padding: .2em;
font-size: .8em;
left: -.2em;
background: grey;
font-size: 1rem;
color: white;
white-space: nowrap;
z-index: 2;
Expand All @@ -65,3 +84,10 @@ a.copybtn > img {
transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
transition-delay: .5s;
}

/* By default the copy button shouldn't show up when printing a page */
@media print {
button.copybtn {
display: none;
}
}
103 changes: 85 additions & 18 deletions docs/_static/copybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@ const messages = {
'copy_to_clipboard': 'In die Zwischenablage kopieren',
'copy_success': 'Kopiert!',
'copy_failure': 'Fehler beim Kopieren',
},
'fr' : {
'copy': 'Copier',
'copy_to_clipboard': 'Copiรฉ dans le presse-papier',
'copy_success': 'Copiรฉ !',
'copy_failure': 'ร‰chec de la copie',
},
'ru': {
'copy': 'ะกะบะพะฟะธั€ะพะฒะฐั‚ัŒ',
'copy_to_clipboard': 'ะกะบะพะฟะธั€ะพะฒะฐั‚ัŒ ะฒ ะฑัƒั„ะตั€',
'copy_success': 'ะกะบะพะฟะธั€ะพะฒะฐะฝะพ!',
'copy_failure': 'ะะต ัƒะดะฐะปะพััŒ ัะบะพะฟะธั€ะพะฒะฐั‚ัŒ',
},
'zh-CN': {
'copy': 'ๅคๅˆถ',
'copy_to_clipboard': 'ๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ',
'copy_success': 'ๅคๅˆถๆˆๅŠŸ!',
'copy_failure': 'ๅคๅˆถๅคฑ่ดฅ',
},
'it' : {
'copy': 'Copiare',
'copy_to_clipboard': 'Copiato negli appunti',
'copy_success': 'Copiato!',
'copy_failure': 'Errore durante la copia',
}
}

Expand All @@ -26,6 +50,31 @@ if( document.documentElement.lang !== undefined
locale = document.documentElement.lang
}

let doc_url_root = DOCUMENTATION_OPTIONS.URL_ROOT;
if (doc_url_root == '#') {
doc_url_root = '';
}

/**
* SVG files for our copy buttons
*/
let iconCheck = `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-check" width="44" height="44" viewBox="0 0 24 24" stroke-width="2" stroke="#22863a" fill="none" stroke-linecap="round" stroke-linejoin="round">
<title>${messages[locale]['copy_success']}</title>
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M5 12l5 5l10 -10" />
</svg>`

// If the user specified their own SVG use that, otherwise use the default
let iconCopy = ``;
if (!iconCopy) {
iconCopy = `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copy" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="#000000" fill="none" stroke-linecap="round" stroke-linejoin="round">
<title>${messages[locale]['copy_to_clipboard']}</title>
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<rect x="8" y="8" width="12" height="12" rx="2" />
<path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" />
</svg>`
}

/**
* Set up copy/paste for code blocks
*/
Expand Down Expand Up @@ -54,10 +103,17 @@ const clearSelection = () => {
}

// Changes tooltip text for two seconds, then changes it back
const temporarilyChangeTooltip = (el, newText) => {
const oldText = el.getAttribute('data-tooltip')
const temporarilyChangeTooltip = (el, oldText, newText) => {
el.setAttribute('data-tooltip', newText)
el.classList.add('success')
setTimeout(() => el.setAttribute('data-tooltip', oldText), 2000)
setTimeout(() => el.classList.remove('success'), 2000)
}

// Changes the copy button icon for two seconds, then changes it back
const temporarilyChangeIcon = (el) => {
el.innerHTML = iconCheck;
setTimeout(() => {el.innerHTML = iconCopy}, 2000)
}

const addCopyButtonToCodeCells = () => {
Expand All @@ -73,12 +129,11 @@ const addCopyButtonToCodeCells = () => {
codeCells.forEach((codeCell, index) => {
const id = codeCellId(index)
codeCell.setAttribute('id', id)
const pre_bg = getComputedStyle(codeCell).backgroundColor;

const clipboardButton = id =>
`<a class="copybtn o-tooltip--left" style="background-color: ${pre_bg}" data-tooltip="${messages[locale]['copy']}" data-clipboard-target="#${id}">
<img src="${DOCUMENTATION_OPTIONS.URL_ROOT}_static/copy-button.svg" alt="${messages[locale]['copy_to_clipboard']}">
</a>`
`<button class="copybtn o-tooltip--left" data-tooltip="${messages[locale]['copy']}" data-clipboard-target="#${id}">
${iconCopy}
</button>`
codeCell.insertAdjacentHTML('afterend', clipboardButton(id))
})

Expand All @@ -88,11 +143,15 @@ function escapeRegExp(string) {

// Callback when a copy button is clicked. Will be passed the node that was clicked
// should then grab the text and replace pieces of text that shouldn't be used in output
function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true) {
function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {

var regexp;
var match;

// Do we check for line continuation characters and "HERE-documents"?
var useLineCont = !!lineContinuationChar
var useHereDoc = !!hereDocDelim

// create regexp to capture prompt and remaining line
if (isRegexp) {
regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)')
Expand All @@ -102,24 +161,31 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl

const outputLines = [];
var promptFound = false;
var gotLineCont = false;
var gotHereDoc = false;
const lineGotPrompt = [];
for (const line of textContent.split('\n')) {
match = line.match(regexp)
if (match) {
promptFound = true
if (removePrompts) {
if (match || gotLineCont || gotHereDoc) {
promptFound = regexp.test(line)
lineGotPrompt.push(promptFound)
if (removePrompts && promptFound) {
outputLines.push(match[2])
} else {
outputLines.push(line)
}
} else {
if (!onlyCopyPromptLines) {
outputLines.push(line)
}
gotLineCont = line.endsWith(lineContinuationChar) & useLineCont
if (line.includes(hereDocDelim) & useHereDoc)
gotHereDoc = !gotHereDoc
} else if (!onlyCopyPromptLines) {
outputLines.push(line)
} else if (copyEmptyLines && line.trim() === '') {
outputLines.push(line)
}
}

// If no lines with the prompt were found then just use original lines
if (promptFound) {
if (lineGotPrompt.some(v => v === true)) {
textContent = outputLines.join('\n');
}

Expand All @@ -133,7 +199,7 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl

var copyTargetText = (trigger) => {
var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);
return formatCopyText(target.innerText, '', false, true, true)
return formatCopyText(target.innerText, '', false, true, true, true, '', '')
}

// Initialize with a callback so we can modify the text before copy
Expand All @@ -142,11 +208,12 @@ var copyTargetText = (trigger) => {
// Update UI with error/success messages
clipboard.on('success', event => {
clearSelection()
temporarilyChangeTooltip(event.trigger, messages[locale]['copy_success'])
temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_success'])
temporarilyChangeIcon(event.trigger)
})

clipboard.on('error', event => {
temporarilyChangeTooltip(event.trigger, messages[locale]['copy_failure'])
temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_failure'])
})
}

Expand Down
29 changes: 20 additions & 9 deletions docs/_static/copybutton_funcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ function escapeRegExp(string) {

// Callback when a copy button is clicked. Will be passed the node that was clicked
// should then grab the text and replace pieces of text that shouldn't be used in output
export function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true) {
export function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {

var regexp;
var match;

// Do we check for line continuation characters and "HERE-documents"?
var useLineCont = !!lineContinuationChar
var useHereDoc = !!hereDocDelim

// create regexp to capture prompt and remaining line
if (isRegexp) {
regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)')
Expand All @@ -18,24 +22,31 @@ export function formatCopyText(textContent, copybuttonPromptText, isRegexp = fal

const outputLines = [];
var promptFound = false;
var gotLineCont = false;
var gotHereDoc = false;
const lineGotPrompt = [];
for (const line of textContent.split('\n')) {
match = line.match(regexp)
if (match) {
promptFound = true
if (removePrompts) {
if (match || gotLineCont || gotHereDoc) {
promptFound = regexp.test(line)
lineGotPrompt.push(promptFound)
if (removePrompts && promptFound) {
outputLines.push(match[2])
} else {
outputLines.push(line)
}
} else {
if (!onlyCopyPromptLines) {
outputLines.push(line)
}
gotLineCont = line.endsWith(lineContinuationChar) & useLineCont
if (line.includes(hereDocDelim) & useHereDoc)
gotHereDoc = !gotHereDoc
} else if (!onlyCopyPromptLines) {
outputLines.push(line)
} else if (copyEmptyLines && line.trim() === '') {
outputLines.push(line)
}
}

// If no lines with the prompt were found then just use original lines
if (promptFound) {
if (lineGotPrompt.some(v => v === true)) {
textContent = outputLines.join('\n');
}

Expand Down
Loading

0 comments on commit db48b10

Please sign in to comment.