class_docstr: "Regularized softmax kernel" estimator, SMREG+, as proposed in the Performers_ paper.
  
  _Performers: "Rethinking attention with performers." K. Choromanski et al. (2020).
  https://arxiv.org/pdf/2009.14794v1.pdf
class_docstr_tok: ["``","Regularized","softmax","kernel","''","estimator",",","SMREG+",",","as","proposed","in","the","Performers_","paper",".","_Performers",":","``","Rethinking","attention","with","performers",".","''","K.","Choromanski","et","al",".","(","2020",")",".","https",":","\/\/arxiv.org\/pdf\/2009.14794v1.pdf"]
docstr: Generate the projection matrix onto the random features
  
  .. note: The heads dimension needs to be taken into account, hence the per-block random matrix
  and not uniformally random.
docstr_tok: ["Generate","the","projection","matrix","onto","the","random","features","..","note",":","The","heads","dimension","needs","to","be","taken","into","account",",","hence","the","per-block","random","matrix","and","not","uniformally","random","."]
code: def _get_feature_map(
      self, dim_input: int, dim_features: int, device: torch.device
  ):
      """
      Generate the projection matrix onto the random features
  
      .. note: The heads dimension needs to be taken into account, hence the per-block random matrix
      and not uniformally random.
      """
  
      # Get per block random unitary matrices.
      # We need enough of them to project the whole input dimension, regardless of the
      # requested dimension of the features
      features = self._get_random_ortho_matrix(
          math.ceil(dim_input / dim_features),
          dim_features,
          norm_distribution=NormDistribution.Uniform,
          device=device,
      ).flatten(0, 1)
      norms = math.sqrt(dim_input) * torch.ones(
          features.shape[0], device=device
      )
      return (torch.diag(norms) @ features)[:dim_input]
  
imports: import math
  from enum import Enum, auto
  from typing import Optional
  import torch
  from torch.autograd.profiler import record_function
  from .base import FeatureMap
label_desc: Use image node_id 2 for calling the SMReg obj's underlying member method code with example usage: obj._get_feature_map(dim_input, dim_features, device) and returns: unknown