code: def log_matrix_product(A, B):
      """
      Computes the matrix products of two matrices in log-space, returning the result
      in log-space. This is useful for calculating the vector chain rule for Jacobian
      terms.
      """
      return torch.logsumexp(A.unsqueeze(-1) + B.unsqueeze(-3), dim=-2)
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from ..None import constraints
  from ..torch_transform import TransformModule
  from ..util import copy_docs_from
  from .neural_autoregressive import ELUTransform, LeakyReLUTransform, TanhTransform
label_desc: Use image node_id 1 for calling a global function with example usage: log_matrix_product(A, B) and returns: torch