code: def plot_top_losses(
      x: TensorText,
      y: TensorCategory,
      samples,
      outs,
      raws,
      losses,
      trunc_at=150,
      **kwargs,
  ):
      rows = get_empty_df(len(samples))
      samples = L((s[0].truncate(trunc_at), *s[1:]) for s in samples)
      for i, l in enumerate(["input", "target"]):
          rows = [
              b.show(ctx=c, label=l, **kwargs)
              for b, c in zip(samples.itemgot(i), rows)
          ]
      outs = L(
          o + (TitledFloat(r.max().item()), TitledFloat(l.item()))
          for o, r, l in zip(outs, raws, losses)
      )
      for i, l in enumerate(["predicted", "probability", "loss"]):
          rows = [
              b.show(ctx=c, label=l, **kwargs)
              for b, c in zip(outs.itemgot(i), rows)
          ]
      display_df(pd.DataFrame(rows))
  
imports: from __future__ import annotations
  from ..basics import *
  from .core import *
  from .data import *
  from .models.core import *
  from .models.awdlstm import *
  from ..callback.rnn import *
  from ..callback.progress import *
  from .models.core import _model_meta
label_desc: Use image node_id 13 for calling a global function with example usage: plot_top_losses(x, y, samples, outs, raws, losses, trunc_at) without return types