code: def test_bce_with_logits_loss(problem_type, loss_func_name):
      preds = []
      targets = []
      random.seed(123)
      torch.manual_seed(123)
  
      for i in range(100):
          bs = random.randint(1, 16)
          preds.append(torch.randn(bs, 1))
          targets.append(torch.rand(bs, 1))
      preds = torch.cat(preds)
      targets = torch.cat(targets)
  
      loss_func = get_loss_func(
          problem_type=problem_type,
          mixup_active=False,
          loss_func_name=loss_func_name,
      )
  
      score1 = loss_func(input=preds, target=targets)
      preds = preds.sigmoid()
      bceloss = torch.nn.BCELoss()
      score2 = bceloss(input=preds, target=targets)
      assert pytest.approx(score1, 1e-6) == score2
  
imports: import os
  import random
  import shutil
  import tempfile
  import pytest
  import torch
  from sklearn.metrics import f1_score, log_loss
  from torchmetrics import MeanMetric, RetrievalHitRate
  import autogluon.core.metrics
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.multimodal.constants import MULTICLASS, Y_PRED, Y_TRUE
  from autogluon.multimodal.optimization.utils import compute_hit_rate, get_loss_func, get_metric
  from autogluon.multimodal.utils import compute_score, infer_metrics
  from ..utils.unittest_datasets import HatefulMeMesDataset, PetFinderDataset
  from ..utils.utils import get_home_dir
label_desc: Use image node_id 2 for calling a global function with example usage: test_bce_with_logits_loss(problem_type, loss_func_name) without return types