code: def set_class_masks(self, num_classes, centers_per_class):
      total_num_centers = num_classes * centers_per_class
      self.diff_class_mask = torch.ones(
          total_num_centers, total_num_centers, dtype=torch.bool
      )
      self.same_class_mask = torch.zeros(
          total_num_centers, total_num_centers, dtype=torch.bool
      )
      for i in range(num_classes):
          s, e = i * centers_per_class, (i + 1) * centers_per_class
          curr_block = torch.ones(centers_per_class, centers_per_class)
          curr_block = torch.triu(curr_block, diagonal=1)
          self.same_class_mask[s:e, s:e] = curr_block
          self.diff_class_mask[s:e, s:e] = 0
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/regularizers/sparse_centers_regularizer.py
imports: import torch
  from ..distances import CosineSimilarity
  from ..reducers import DivisorReducer
  from ..utils import common_functions
  from .base_regularizer import BaseRegularizer
label_desc: Use image node_id 3 for calling the SparseCentersRegularizer obj's underlying member method code with example usage: obj.set_class_masks(num_classes, centers_per_class) without return types