docstr: targets: [label, valid_ratio, word_positions]
docstr_tok: ["targets",":","[","label",",","valid_ratio",",","word_positions","]"]
code: def forward(self, inputs, targets=None):
      """
      targets: [label, valid_ratio, word_positions]
      """
      out_enc = self.encoder(inputs)
      valid_ratios = None
      word_positions = targets[-1]
  
      if len(targets) > 1:
          valid_ratios = targets[-2]
  
      if self.training:
          label = targets[0]  # label
          label = paddle.to_tensor(label, dtype="int64")
          final_out = self.decoder(
              inputs, out_enc, label, valid_ratios, word_positions
          )
      if not self.training:
          final_out = self.decoder(
              inputs,
              out_enc,
              label=None,
              valid_ratios=valid_ratios,
              word_positions=word_positions,
              train_mode=False,
          )
      return final_out
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import ParamAttr
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling the RobustScannerHead obj's underlying member method code with example usage: obj.forward(inputs, targets) and returns: final_out