parameters: (self, state: MFGPredatorPreyState, player: int)
docstring: Updates `tensor` and `dict` to reflect `state` from PoV of `player`.
docstring_summary: Updates `tensor` and `dict` to reflect `state` from PoV of `player`.
docstring_tokens: Updates tensor and dict to reflect state from PoV of player .
function: def set_from(self, state: MFGPredatorPreyState, player: int):
      """Updates `tensor` and `dict` to reflect `state` from PoV of `player`."""
      del player
      # We update the observation via the shaped tensor since indexing is more
      # convenient than with the 1-D tensor. Both are views onto the same memory.
      self.tensor.fill(0)
      # state.pos is None for the initial (blank) state, don't set any
      # position bit in that case.
      if state.pos is not None:
        if not (state.pos >= 0).all() or not (state.pos < self.size).all():
          raise ValueError(
              f"Expected {state} positions to be in [0, {self.size})")
        self.dict["x"][state.pos[0]] = 1
        self.dict["y"][state.pos[1]] = 1
      if not 0 <= state.t <= self.horizon:
        raise ValueError(f"Expected {state} time to be in [0, {self.horizon}]")
      self.dict["t"][state.t] = 1
function_tokens: def set_from ( self , state : MFGPredatorPreyState , player : int ) : del player # We update the observation via the shaped tensor since indexing is more # convenient than with the 1-D tensor. Both are views onto the same memory. self . tensor . fill ( 0 ) # state.pos is None for the initial (blank) state, don't set any # position bit in that case. if state . pos is not None : if not ( state . pos >= 0 ) . all ( ) or not ( state . pos < self . size ) . all ( ) : raise ValueError ( f"Expected {state} positions to be in [0, {self.size})" ) self . dict [ "x" ] [ state . pos [ 0 ] ] = 1 self . dict [ "y" ] [ state . pos [ 1 ] ] = 1 if not 0 <= state . t <= self . horizon : raise ValueError ( f"Expected {state} time to be in [0, {self.horizon}]" ) self . dict [ "t" ] [ state . t ] = 1