Advanced printing functions.
source
display_colums
display_colums (display_list, num_col=3)
a = [torch.rand((3, 3))]*3
a
[tensor([[0.6266, 0.3672, 0.3988],
[0.6061, 0.2596, 0.4855],
[0.3177, 0.8166, 0.3100]]),
tensor([[0.6266, 0.3672, 0.3988],
[0.6061, 0.2596, 0.4855],
[0.3177, 0.8166, 0.3100]]),
tensor([[0.6266, 0.3672, 0.3988],
[0.6061, 0.2596, 0.4855],
[0.3177, 0.8166, 0.3100]])]
v.s.
display_colums(a) # works only in notebook
source
ndarray_to_latex
ndarray_to_latex (arr)
Returns a LaTeX {pmatrix*}[r]
as a string
source
tensor_to_latex
tensor_to_latex (tensor)
Returns a LaTeX {pmatrix*}[r]
as a string
tex = tensor_to_latex(torch.full((3,3), 2))
print(tex)
\begin{pmatrix*}[r]
2 & 2 & 2\\
2 & 2 & 2\\
2 & 2 & 2\\
\end{pmatrix*}
source
print_markdown
print_markdown (text, print_raw=False)
print_markdown("$\sqrt{2}$, *Test text*")
print_markdown(f"${tex}$")
\(\begin{pmatrix*}[r]
2 & 2 & 2\\
2 & 2 & 2\\
2 & 2 & 2\\
\end{pmatrix*}\)
source
print_table
print_table (col_headings:list, data:<built-infunctionarray>,
row_headings=None, print_raw=False)
Print a table:
h = ["head1", "head2", "head3"]
r = ["sample", "dataset"]
d = np.random.rand(2, 3)
print_table(h, d, r)
sample |
0.32 |
0.23 |
0.27 |
dataset |
0.74 |
0.41 |
0.00 |
Back to top