code: def rwkv_linear_attention_xpu(
      time_decay: torch.Tensor,
      time_first: torch.Tensor,
      key: torch.Tensor,
      value: torch.Tensor,
      state: List[torch.Tensor] = None,
      return_state: bool = False,
  ):
      if state is None:
          num_state = torch.zeros(
              key.size(0),
              key.size(-1),
              dtype=key.dtype,
              device=key.device,
          )
          den_state = torch.zeros(
              key.size(0),
              key.size(-1),
              dtype=key.dtype,
              device=key.device,
          )
          max_state = (
              torch.zeros(
                  key.size(0),
                  key.size(-1),
                  dtype=key.dtype,
                  device=key.device,
              )
              - 1e38
          )
      else:
          num_state, den_state, max_state = state
          num_state = num_state.contiguous()
          den_state = den_state.contiguous()
          max_state = max_state.contiguous()
  
      time_decay = -torch.exp(time_decay)
  
      import linear_q4_0
  
      output = linear_q4_0.rwkv_attention_with_state(
          time_decay,
          time_first,
          key,
          value,
          num_state,
          den_state,
          max_state,
      )
  
      if return_state or state is not None:
          state = [num_state, den_state, max_state]
  
      return output, state
  
imports: import torch
  from typing import List
label_desc: Use image node_id 1 for calling a global function with example usage: rwkv_linear_attention_xpu(time_decay, time_first, key, value, state, return_state) and returns: output,  state