class_docstr: network architecture written in paddle.
class_docstr_tok: ["network","architecture","written","in","paddle","."]
docstr: prediction
docstr_tok: ["prediction"]
code: def forward(self, img, canvas):
      """
      prediction
      """
      b, _, H, W = img.shape
      img_feat = self.enc_img(img)
      canvas_feat = self.enc_canvas(canvas)
      h, w = img_feat.shape[-2:]
      feat = paddle.concat([img_feat, canvas_feat], axis=1)
      feat_conv = self.conv(feat)
  
      pos_embed = (
          paddle.concat(
              [
                  self.col_embed[:w].unsqueeze(0).tile([h, 1, 1]),
                  self.row_embed[:h].unsqueeze(1).tile([1, w, 1]),
              ],
              axis=-1,
          )
          .flatten(0, 1)
          .unsqueeze(1)
      )
  
      hidden_state = self.transformer(
          (
              pos_embed + feat_conv.flatten(2).transpose([2, 0, 1])
          ).transpose([1, 0, 2]),
          self.query_pos.unsqueeze(1)
          .tile([1, b, 1])
          .transpose([1, 0, 2]),
      )
  
      param = self.linear_param(hidden_state)
      decision = self.linear_decider(hidden_state)
      return param, decision
  
imports: import paddle
  import paddle.nn
  import math
label_desc: Use image node_id 2 for calling the Painter obj's underlying member method code with example usage: obj.forward(img, canvas) and returns: param,  decision