docstr: Generate a mask for computing the average reachability.
  
  If k is an array then we need to compute the average reachability for each k separately. To do
  this we use a mask to weight the reachability of each k-close neighbor by 1/k and the rest to 0.
docstr_tok: ["Generate","a","mask","for","computing","the","average","reachability",".","If","k","is","an","array","then","we","need","to","compute","the","average","reachability","for","each","k","separately",".","To","do","this","we","use","a","mask","to","weight","the","reachability","of","each","k-close","neighbor","by","1\/k","and","the","rest","to","0","."]
code: def _make_mask(self, reachabilities: torch.Tensor):
      """Generate a mask for computing the average reachability.
  
      If k is an array then we need to compute the average reachability for each k separately. To do
      this we use a mask to weight the reachability of each k-close neighbor by 1/k and the rest to 0.
      """
      mask = torch.zeros_like(reachabilities[0], device=self.device)
      for i, k in enumerate(self.ks):
          mask[:k, i] = torch.ones(k, device=self.device) / k
      return mask
  
file_path: alibi-detect/alibi_detect/od/pytorch/lof.py
imports: from typing import Optional, Union, List, Tuple
  import numpy
  import torch
  from alibi_detect.od.pytorch.ensemble import Ensembler
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 3 for calling the LOFTorch obj's underlying member method code with example usage: obj._make_mask(reachabilities) and returns: mask