Printing functions

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

Back to top