Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c02b728

Browse files
inkawhichJoelMarcey
authored andcommitted
fixing equations in HF learn by example tutorial
1 parent 057f8f5 commit c02b728

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ ENV/
105105

106106
# Rope project settings
107107
.ropeproject
108+
109+
# Mac things
110+
.DS_Store

beginner_source/hybrid_frontend/learning_hybrid_frontend_through_example_tutorial.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
===============================================
55
**Author:** `Nathan Inkawhich <https://github.com/inkawhich>`_
66
7-
Hybrid Frontend Information
8-
---------------------------
9-
107
This document is meant to highlight the syntax of the Hybrid Frontend
118
through a non-code intensive example. The Hybrid Frontend is one of the
129
new shiny features of Pytorch 1.0 and provides an avenue for developers
@@ -20,6 +17,9 @@
2017
PyTorch), then gradually transition the proven model to graph mode for
2118
production, when speed and resouce consumption become critical.
2219
20+
Hybrid Frontend Information
21+
---------------------------
22+
2323
The process for transitioning a model to graph mode is as follows.
2424
First, the developer constructs, trains, and tests the model in eager
2525
mode. Then they incrementally **trace** and **script** each
@@ -60,21 +60,23 @@ class definitions.
6060
The function we seek to implement, :math:`Y(x)`, is defined for
6161
:math:`x \epsilon \mathbb{N}` as
6262
63-
.. math:: z(x) = \Biggl \lfloor \frac{\sqrt{\prod_{i=1}^{ | 2 x | } i}}{5} \Biggr \rfloor
63+
.. math::
64+
65+
z(x) = \Biggl \lfloor \\frac{\sqrt{\prod_{i=1}^{|2 x|}i}}{5} \Biggr \\rfloor
6466
6567
.. math::
6668
67-
Y(x) = \begin{cases}
68-
\frac{z(x)}{2} & if z(x)\%2 == 0 \\
69-
z(x) & otherwise
70-
\end{cases}
69+
Y(x) = \\begin{cases}
70+
\\frac{z(x)}{2} & \\text{if } z(x)\%2 == 0 \\
71+
z(x) & \\text{otherwise}
72+
\end{cases}
7173
7274
.. math::
7375
74-
\begin{array}{| r | r |} \hline
75-
x &1 &2 &3 &4 &5 &6 &7 \\ \hline
76-
Y(x) &0 &0 &-5 &20 &190 &-4377 &-59051 \\ \hline
77-
\end{array}
76+
\\begin{array}{| r | r |} \hline
77+
x &1 &2 &3 &4 &5 &6 &7 \\ \hline
78+
Y(x) &0 &0 &-5 &20 &190 &-4377 &-59051 \\ \hline
79+
\end{array}
7880
7981
As mentioned, the computation is split into four parts. Part one is the
8082
simple tensor calculation of :math:`|2x|`, which can be traced. Part two

0 commit comments

Comments
 (0)