class_docstr: Define quantile embedding layer, i.e. phi in the IQN paper (arXiv: 1806.06923).
class_docstr_tok: ["Define","quantile","embedding","layer",",","i.e",".","phi","in","the","IQN","paper","(","arXiv",":","1806.06923",")","."]
code: def cos_embed(self, tau):
      integers = torch.repeat_interleave(
          torch.arange(0, self.n_cos_embedding).unsqueeze(dim=0),
          repeats=tau.shape[-1],
          dim=0,
      ).to(tau.device)
      return torch.cos(pi * tau.unsqueeze(dim=-1) * integers)
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/modules/iqn_modules.py
imports: from math import pi
  import torch
  from torch import nn
label_desc: Use image node_id 3 for calling the QuantileLayer obj's underlying member method code with example usage: obj.cos_embed(tau) and returns: torch