-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Adding katex rendering of equations, and required edits to equations. #8848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Nice! If it's possible, could you build and host webpage somewhere for easier review purpose? I'm not that familiar with katex to be confident with just reading the code... |
|
Not sure if you will be able to see this, but here goes: If that doesn't work, you can test the code locally by going into /doc directory, then typing make html it will put the site files in /docs/build/html |
ssnl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! The link you gave works. Most comments are on \text wrappers. There are a few changes that look unintended to me too.
torch/nn/modules/activation.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/activation.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/activation.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/conv.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/conv.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/pooling.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/modules/pooling.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
docs/source/conf.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
docs/source/conf.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
docs/source/conf.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
this seem to accidentally include changes from other commits |
|
should be resolved now. |
|
*@fmassa @ssnl*
Is that an arbitrary rule of thumb though?
I did some reading up on this, and the only thing I found that seemed
definitive is that variable names should be italicized. Discrete
quantities, constants, operators and function names are romanized. Visually
this differentiates, at a glance, the parts of an equation that are mutable
from the parts that are fixed.
For instance, see https://iupac.org/cms/wp-content/uploads/2016/01/ICTNS-
On-the-use-of-italic-and-roman-fonts-for-symbols-in-scientific-text.pdf
"The overall rule is that symbols representing physical quantities (or
variables) are italic, but symbols representing units, or labels, are
roman. Sometimes there may seem to be doubt as to whether a symbol
represents a quantity or has some other meaning (such as a label): a good
general rule is that quantities, or variables, can be given a value, but
labels cannot. Vectors, tensors and matrices are usually denoted using a
bold-face (heavy) font, but they should still be italic since they are
still quantities."
So the question comes in when you have variables that are more word-like. I
think this is more of a modern-day problem; theorems in the past would
always define short variable names, but with coding, it is much more common
to have longer names for variables, such as *padding *and *dilation*. In
text, this is usually handled with a coding font that distinguishes a code
variable from normal text, because these things are different than standard
words.
In my opinion, people have begun to conflate the idea that supporting text
in equations should be romanized (it most definitely should), with the idea
that word-like variables should be romanized.
The argument sometimes given is that the spacing for romanized words are
handled better than italics, and thus making it more readable. However, in
cases where the layout would be affected by character spacing, latex has a
function called mathit{} for long variable names (that writes italics).
*Arguments for italicizing all variable names*
1. Cleaner code / less overhead to maintain and write
2. Some find it more readable when rendered (I do and others do!)
3. Consistent for all variables
4. Simple, well-defined rule
5. Reduces complexity around sub- and superscripted variables.
6. Doesn't need to be double-escaped in some situations.
7. ...?
*Arguments for romanizing variables name that are longer than 2
characters. *
1. Some find it more readable when rendered (Simon, Francisco, and others
do!)
2. That's the way someone else had written it before.
3. ...?
So that's my take on this. To be blunt, I think Aldus Manutius would be
turning in his grave if he saw the way we are romanizing variable names.
But I'm no mathematician, either.
Either way, we should have a clearly defined and articulated standard for
consistency.
In the meantime, I've put /text{...} back in conv.py, and
…On Mon, Jun 25, 2018 at 3:06 PM, Francisco Massa ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In torch/nn/modules/conv.py
<#8848 (comment)>:
> @@ -119,7 +118,7 @@ class Conv1d(_ConvNd):
In other words, for an input of size :math:`(N, C_{in}, L_{in})`, if you want a
depthwise convolution with a depthwise multiplier `K`,
then you use the constructor arguments
- :math:`(\text{in_channels}=C_{in}, \text{out_channels}=C_{in} * K, ..., \text{groups}=C_{in})`
+ :math:`(in\_channels=C_{in}, out\_channels=C_{in} * K, ..., groups=C_{in})`
I'd vote for keeping the \text. My rule of thumb is that if the variable
has more than one letter, then it should ideally not be on italic
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8848 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAB8YUuelHXYIbhpEOoxfLEBq-1rhdCMks5uAV7-gaJpZM4U2Lhs>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@goodlux we use flake8 to lint our python code. The lint test is failing (see https://travis-ci.org/pytorch/pytorch/jobs/397456179, this is under "continuous-integration/travis-ci/pr". You can run the lint locally with "python -m flake8" |
|
@goodlux, looking at https://github.com/pytorch/pytorch/pull/8848/files (which is the list of changed files), some of the \text{ } removals were not undone. Maybe you haven't pushed a commit? |
|
@goodlux I still don't understand the need for a new PR. And this PR definitely shouldn't remove those \text wrappers.
So, please just (b) & (c) are absolutely merge-blocking. For (a), since you are fixing them anyways, I just don't see why it can't be done in this PR. Please feel free to correct me if I misunderstood your points. |
|
@pytorchbot retest this please |
|
@ssnl - The reason I want to make any content changes in a new PR, is because my local branch is polluted. I'm not able to pull --rebase as recommended, I'm still getting merge conflicts over /third_party/onnx and the fold.py file. I'd rather just start with a new, clean branch...and fix these minor issues, rather than spending time trying to debug issues with a polluted local branch. If you INSIST though, I'm happy to sync up in another meeting and get to the bottom of it. Again, I would prefer though to just move on to a clean branch...there are a ton of content changes that need to be made and I'd like to start working on them. As far as: "(b) & (c) are absolutely merge-blocking. " - Agreed. I fixed these via github browser...these will be the last changes I'm making to this branch. |
|
Also: To answer (2) and (3) above:
|
|
@goodlux according to this PR thread, there are still unresolved pull request comments above (some of the \text deletions are still present). The GitHub pull request review comments will auto-minimize after the particular lines of code they are tagged in change. If you have a polluted local branch, you can try something like the following:
|
|
@zou3519 goodlux and I rebased the PR correctly late last night and got his local git branch in a good state. He will revert the |
|
@soumith @zou3519 Thanks for commenting and fixing. :) @goodlux Sorry if I sounded negative. I didn't mean to. @zou3519 's tip on
After doing (2) or (3), you probably need to Hope that this helps. |
|
@goodlux the rebase doesn't look right... |
|
@weiyangfb specifically, what is wrong? I've corrected everything that @ssnl pointed out, in this branch, as requested by him. @soumith actually fixed the branch, and I've used --rebase since. Beyond that, I'm not sure how to proceed. Please advise what I need to do so this PR can be complete. |
|
@goodlux i'll fix your branch and push the PR to master. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SsnL has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…pytorch#8848) Summary: This fixes issue pytorch#8529. - Adds Katex extension to conf.py and requirements.txt - Fixes syntax differences in docs - Should allow documentation pages to render faster Pull Request resolved: pytorch#8848 Reviewed By: soumith Differential Revision: D8677702 Pulled By: goodlux fbshipit-source-id: c4a832c5879e0eebcb14763b35a41663331ba23f
This fixes issue #8529.