class_docstr: Implements a gated recurrent unit for use in AttentionNet
class_docstr_tok: ["Implements","a","gated","recurrent","unit","for","use","in","AttentionNet"]
code: def forward(self, inputs: TensorType, **kwargs) -> TensorType:
      # Pass in internal state first.
      h, X = inputs
  
      r = torch.tensordot(X, self._w_r, dims=1) + torch.tensordot(
          h, self._u_r, dims=1
      )
      r = torch.sigmoid(r)
  
      z = (
          torch.tensordot(X, self._w_z, dims=1)
          + torch.tensordot(h, self._u_z, dims=1)
          - self._bias_z
      )
      z = torch.sigmoid(z)
  
      h_next = torch.tensordot(X, self._w_h, dims=1) + torch.tensordot(
          (h * r), self._u_h, dims=1
      )
      h_next = torch.tanh(h_next)
  
      return (1 - z) * h + z * h_next
  
imports: from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.framework import TensorType
label_desc: Use image node_id 2 for calling the GRUGate obj's underlying member method code with example usage: obj.forward(inputs) and returns: unknown