code: def create_position_codes(n_pos, dim, out):
      """
      Create positional codes and store them in ``out``.
      """
      position_enc = np.array(
          [
              [
                  pos / np.power(10000, 2 * j / dim)
                  for j in range(dim // 2)
              ]
              for pos in range(n_pos)
          ]
      )
  
      out.detach_()
      out.requires_grad = False
      out[:, 0::2] = torch.FloatTensor(np.sin(position_enc)).type_as(
          out
      )
      out[:, 1::2] = torch.FloatTensor(np.cos(position_enc)).type_as(
          out
      )
  
imports: import numpy
  import torch
  import torch.nn
  from parlai.core.opt import Opt
label_desc: Use image node_id 1 for calling a global function with example usage: create_position_codes(n_pos, dim, out) without return types