code: def get_torch_train_test_mask(n: int, ratio: float = 0.8):
      """
          Generates random torch tensor mask
      :param n: size of mask
      :param ratio: mimics train/test split. `ratio` sets number of True vs False mask entries.
      :return: train and test torch tensor masks
      """
      _, _, torch = lazy_torch_import_has_dependency()  # noqa: F811
  
      train_mask = torch.zeros(n, dtype=torch.bool).bernoulli(ratio)
      test_mask = ~train_mask
      return train_mask, test_mask
  
imports: from collections import Counter
  from typing import Dict, Optional, TYPE_CHECKING, Tuple
  import numpy
  import pandas
  from .None import constants
  from .feature_utils import FeatureEngine, FeatureMixin, resolve_feature_engine, XSymbolic, YSymbolic, resolve_X, resolve_y
  from .util import setup_logger
label_desc: Use image node_id 8 for calling a global function with example usage: get_torch_train_test_mask(n, ratio) and returns: train_mask,  test_mask