code: def test_collect_stats_flag(self):
      self.assertTrue(c_f.COLLECT_STATS == WITH_COLLECT_STATS)
      for x in [True, False, True, False, WITH_COLLECT_STATS]:
          c_f.COLLECT_STATS = x
          loss_fn = TripletMarginLoss()
          self.assertTrue(loss_fn.collect_stats == x)
          self.assertTrue(loss_fn.distance.collect_stats == x)
          self.assertTrue(loss_fn.reducer.collect_stats == x)
      for x in [True, False]:
          loss_fn = TripletMarginLoss(collect_stats=x)
          self.assertTrue(loss_fn.collect_stats == x)
  
file_path: pytorch-metric-learning/tests/utils/test_common_functions.py
imports: import logging
  import unittest
  import numpy
  import torch
  from sklearn.preprocessing import StandardScaler
  from pytorch_metric_learning.losses import TripletMarginLoss
  from pytorch_metric_learning.utils import common_functions
  from ..None import WITH_COLLECT_STATS
label_desc: Use image node_id 2 for calling the TestCommonFunctions obj's underlying member method code with example usage: obj.test_collect_stats_flag() without return types