Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
29211740
Unverified
Commit
29211740
authored
Apr 28, 2022
by
Nicolas Hug
Committed by
GitHub
Apr 28, 2022
Browse files
Make weights tables row size smaller (#5904)
* Custom class for weights table * Proper CSS
parent
e0467c64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
docs/source/_static/css/custom_torchvision.css
docs/source/_static/css/custom_torchvision.css
+12
-1
docs/source/conf.py
docs/source/conf.py
+2
-0
No files found.
docs/source/_static/css/custom_torchvision.css
View file @
29211740
/* This rule
(and possibly this entire file)
should be removed once
/* This rule should be removed once
https://github.com/pytorch/pytorch_sphinx_theme/issues/125 is fixed.
We override the rule so that the links to the notebooks aren't hidden in the
...
...
@@ -10,3 +10,14 @@ article.pytorch-article .sphx-glr-download-link-note.admonition.note,
article
.pytorch-article
.reference.download.internal
,
article
.pytorch-article
.sphx-glr-signature
{
display
:
block
;
}
/* These 2 rules below are for the weight tables (generated in conf.py) to look
* better. In particular we make their row height shorter */
.table-weights
td
,
.table-weights
th
{
margin-bottom
:
0.2rem
;
padding
:
0
!important
;
line-height
:
1
!important
;
}
.table-weights
p
{
margin-bottom
:
0.2rem
!important
;
}
docs/source/conf.py
View file @
29211740
...
...
@@ -342,6 +342,7 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
v
=
f
"`link <
{
v
}
>`__"
table
.
append
((
str
(
k
),
str
(
v
)))
table
=
tabulate
(
table
,
tablefmt
=
"rst"
)
lines
+=
[
".. rst-class:: table-weights"
]
# Custom CSS class, see custom_torchvision.css
lines
+=
[
".. table::"
,
""
]
lines
+=
textwrap
.
indent
(
table
,
" "
*
4
).
split
(
"
\n
"
)
lines
.
append
(
""
)
...
...
@@ -369,6 +370,7 @@ def generate_weights_table(module, table_name, metrics):
generated_dir
=
Path
(
"generated"
)
generated_dir
.
mkdir
(
exist_ok
=
True
)
with
open
(
generated_dir
/
f
"
{
table_name
}
_table.rst"
,
"w+"
)
as
table_file
:
table_file
.
write
(
".. rst-class:: table-weights
\n
"
)
# Custom CSS class, see custom_torchvision.css
table_file
.
write
(
".. table::
\n
"
)
table_file
.
write
(
f
" :widths: 100
{
'20 '
*
len
(
metrics_names
)
}
20 10
\n\n
"
)
table_file
.
write
(
f
"
{
textwrap
.
indent
(
table
,
' '
*
4
)
}
\n\n
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment