class_docstr: Image Transformer in mesh_tensorflow.
class_docstr_tok: ["Image","Transformer","in","mesh_tensorflow","."]
docstr: Learned 2d positional embedding for images.
docstr_tok: ["Learned","2d","positional","embedding","for","images","."]
code: def create_positional_emb_2d(self, targets):
      """Learned 2d positional embedding for images."""
      mesh = targets.mesh
  
      positional_emb_rows_var = mtf.get_variable(
          mesh,
          "positional_emb_rows",
          mtf.Shape([self.pos_dim, self.model_dim]),
          initializer=tf.random_normal_initializer(),
          activation_dtype=self.activation_type,
      )
      positional_emb_cols_var = mtf.get_variable(
          mesh,
          "positional_emb_cols",
          mtf.Shape([self.pos_dim, self.model_dim]),
          initializer=tf.random_normal_initializer(),
          activation_dtype=self.activation_type,
      )
  
      targets_position_x = mtf.range(
          mesh, self.rows_dim, dtype=tf.int32
      )
      targets_position_y = mtf.range(
          mesh, self.cols_dim, dtype=tf.int32
      )
      position_x = mtf.broadcast(
          mtf.gather(
              positional_emb_rows_var, targets_position_x, self.pos_dim
          ),
          mtf.Shape([self.rows_dim, self.cols_dim, self.model_dim]),
      )
  
      position_y = mtf.broadcast(
          mtf.gather(
              positional_emb_cols_var, targets_position_y, self.pos_dim
          ),
          mtf.Shape([self.rows_dim, self.cols_dim, self.model_dim]),
      )
      return position_x + position_y
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import mesh_tensorflow
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import mtf_model
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 16 for calling the MtfImageTransformer obj's underlying member method code with example usage: obj.create_positional_emb_2d(targets) and returns: unknown