code: def layer_info(learn, *xb):
      "Return layer infos of `model` on `xb` (only support batch first inputs)"
  
      def _track(m, i, o):
          params, trainable, shape = "", "", ""
          same = any(
              (
                  isinstance(x[0], torch.Tensor)
                  and x[0].shape[1:] == x[1].shape
                  for x in zip(i, o)
              )
          )
          shape = apply(lambda x: x.shape, o)
          if hasattr(m, "weight"):  # non activation layer
              params, trainable = total_params(m)
          return (type(m).__name__, params, trainable, shape, same)
  
      with Hooks(flatten_model(learn.model), _track) as h:
          batch = apply(lambda o: o[:1], xb)
          train_only_cbs = [
              cb for cb in learn.cbs if hasattr(cb, "_only_train_loop")
          ]
          with learn.removed_cbs(
              train_only_cbs
          ), learn.no_logging(), learn as l:
              r = l.get_preds(dl=[batch], inner=True, reorder=False)
          return h.stored
  
imports: from __future__ import annotations
  from ..basics import *
label_desc: Use image node_id 9 for calling a global function with example usage: layer_info(learn) and returns: type,  params,  trainable,  shape,  same, h