.Kind (page): .Type (issues) / .Layout ()
Bundle: n/a (regular page)
[ categories | tags | search ]
ox-hugo Test Site

This is the test site for the ox-hugo package for Emacs/Org-mode.

It is updated automatically after each commit to the ox-hugo repo. It was last updated on Mar 30, 2021 23:34 UTC.


This page was created/modified in commit 2efd045 "Add test case for https://github.com/kaushalmodi/ox-hugo/issues/424" on 2021-03-30.
Markdown source of this page

Issue 424 – Exporting Results blocks from Included Org files

tags: issues include results


Description/Summary

Example of using #+include to export code block and results block from that included file.

Content

Note
By default, Org will export only the code block. So if you want to export the #+results block as well, you need to add :exports both to the source block header.
lm_adam = LinearModel()
lm_adam.to(device)
optimizer = Adam(lm_adam.parameters(), weight_decay=0.0001)

for epoch in range(epochs):
    running_loss = 0.0

    for i, (x, y) in enumerate(dummy_data):

        x_ = Variable(x, requires_grad=True)
        y_ = Variable(y)

        # Forward pass
        y_pred = lm_adam(x_)

        # Compute loss
        loss = criterion(y_pred, y_)

        # Zero gradients, backward pass, and update weights
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

        # Update the running loss
        running_loss += loss.item()

    print(f"Epoch: {epoch + 1:02}/{epochs} Loss: {running_loss:.5e}")
Epoch: 01/20 Loss: 1.35205e+03
Epoch: 02/20 Loss: 1.33684e+03
Epoch: 03/20 Loss: 1.32229e+03
Epoch: 04/20 Loss: 1.30802e+03
Epoch: 05/20 Loss: 1.29396e+03
Epoch: 06/20 Loss: 1.28007e+03
Epoch: 07/20 Loss: 1.26634e+03
Epoch: 08/20 Loss: 1.25274e+03
Epoch: 09/20 Loss: 1.23927e+03
Epoch: 10/20 Loss: 1.22593e+03
Epoch: 11/20 Loss: 1.21272e+03
Epoch: 12/20 Loss: 1.19962e+03
Epoch: 13/20 Loss: 1.18664e+03
Epoch: 14/20 Loss: 1.17378e+03
Epoch: 15/20 Loss: 1.16103e+03
Epoch: 16/20 Loss: 1.14839e+03
Epoch: 17/20 Loss: 1.13587e+03
Epoch: 18/20 Loss: 1.12345e+03
Epoch: 19/20 Loss: 1.11114e+03
Epoch: 20/20 Loss: 1.09893e+03

Page (Debug)

Page VariableValue
Name "Issue 424 – Exporting Results blocks from Included Org files"
Title "Issue 424 – Exporting Results blocks from Included Org files"
ResourceType "page"
Kind "page"
Section "issues"
Draft false
Type "issues"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/issues/424-exporting-results-blocks-from-included-org-files/"
RelPermalink "/issues/424-exporting-results-blocks-from-included-org-files/"
Data
page.Data{} (type:page.Data)
NextPageIssue 382 – Newlines inserted before/after begin/end keywords of LaTeX equations
PrevPageIssue 430 – Disabling exporting of code blocks
NextInSectionIssue 382 – Newlines inserted before/after begin/end keywords of LaTeX equations
PrevInSectionIssue 430 – Disabling exporting of code blocks

Page Params (Debug)

KeyTypeValue
descriptionstring " Example of using `#+include` to export code block **and** results\n block from that included file.\n "
draftbool false
iscjklanguagebool false
lastmodtime.Time 2021-03-30 12:01:10 -0400 -0400
tags[]string "issues" "include" "results"
titlestring "Issue 424 – Exporting Results blocks from Included Org files"

File Object (Debug)

FileInfo VariableValue
UniqueID "3ce20039c80ce2b095dd515a99f13497"
BaseFileName "424-exporting-results-blocks-from-included-org-files"
TranslationBaseName "424-exporting-results-blocks-from-included-org-files"
Lang "en"
Section "issues"
LogicalName "424-exporting-results-blocks-from-included-org-files.md"
Dir "issues/"
Ext "md"
Path "issues/424-exporting-results-blocks-from-included-org-files.md"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.68.3 (commit 157669a0) .
[Test Site home | ox-hugo home]