code: def _lpips_update(
      img1: Tensor, img2: Tensor, net: nn.Module, normalize: bool
  ) -> Tuple[Tensor, Union[int, Tensor]]:
      if not (
          _valid_img(img1, normalize) and _valid_img(img2, normalize)
      ):
          raise ValueError(
              "Expected both input arguments to be normalized tensors with shape [N, 3, H, W]."
              f" Got input with shape {img1.shape} and {img2.shape} and values in range"
              f" {[img1.min(), img1.max()]} and {[img2.min(), img2.max()]} when all values are"
              f" expected to be in the {[0,1] if normalize else [-1,1]} range."
          )
      loss = net(img1, img2, normalize=normalize).squeeze()
      return loss, img1.shape[0]
  
imports: import inspect
  import os
  from typing import List, NamedTuple, Optional, Tuple, Union
  import torch
  from torch import Tensor, nn
  from typing_extensions import Literal
  from torchmetrics.utilities.imports import _TORCHVISION_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_13
label_desc: Use image node_id 7 for calling a global function with example usage: _lpips_update(img1, img2, net, normalize) and returns: loss,  img1