code: def element_product_sum(
      tensor1: tuple[torch.Tensor, ...],
      tensor2: tuple[torch.Tensor, ...],
  ) -> torch.Tensor:
      """Compute the sum of all the element-wise product."""
      assert len(tensor1) == len(
          tensor2
      ), "The number of tensors must be the same."
      # Skip zero gradients
      ret = [
          torch.sum(t1 * t2)
          for t1, t2 in zip(tensor1, tensor2)
          if t1 is not None and t2 is not None
      ]
      if not ret:
          return torch.tensor(0)
      if len(ret) == 1:
          return ret[0]
      return cast(torch.Tensor, sum(ret))
  
imports: from __future__ import annotations
  from typing import Any, cast
  import torch
  import torch.nn
  from nni.mutable import Categorical, Mutable, Sample, SampleValidationError, MutableExpression, label_scope, auto_label
  from nni.nas.nn.pytorch import Repeat, recursive_freeze
  from .base import BaseSuperNetModule
  from .differentiable import DifferentiableMixedLayer, DifferentiableMixedInput
  from ._expression_utils import traverse_all_options
label_desc: Use image node_id 5 for calling a global function with example usage: element_product_sum(tensor1, tensor2) and returns: cast, torch, ret