示例#1
0
 def infer_action(self, observations, *args, **kwargs):
     obs_buf = as_float_c_array(observations[0])
     hp_buf  = as_float_c_array(observations[1])
     n, height, width, n_channel = observations[0].shape
     buf = np.empty((n,), dtype=np.int32)
     act_buf = as_int32_c_array(buf)
     _LIB.runaway_infer_action(obs_buf, hp_buf, n, height, width, n_channel,
                               self.attack_base, act_buf, self.away_channel, self.move_back)
     return buf
示例#2
0
 def infer_action(self, observations, *args, **kwargs):
     obs_buf = as_float_c_array(observations[0])
     hp_buf  = as_float_c_array(observations[1])
     n, height, width, n_channel = observations[0].shape
     buf = np.empty((n,), dtype=np.int32)
     act_buf = as_int32_c_array(buf)
     _LIB.runaway_infer_action(obs_buf, hp_buf, n, height, width, n_channel,
                               self.attack_base, act_buf, self.away_channel, self.move_back)
     return buf
示例#3
0
    def infer_action(self, states, *args, **kwargs):
        obs_buf = as_float_c_array(states[0])
        hp_buf = as_float_c_array(states[1])
        n, height, width, n_channel = states[0].shape
        buf = np.empty((n, ), dtype=np.int32)
        act_buf = as_int32_c_array(buf)
        attack_base = self.attack_base

        view2attack_buf = as_int32_c_array(self.view2attack)

        _LIB.gather_infer_action(obs_buf, hp_buf, n, height, width, n_channel,
                                 act_buf, attack_base, view2attack_buf)
        return buf
示例#4
0
    def infer_action(self, states, *args, **kwargs):
        obs_buf = as_float_c_array(states[0])
        hp_buf  = as_float_c_array(states[1])
        n, height, width, n_channel = states[0].shape
        buf = np.empty((n,), dtype=np.int32)
        act_buf = as_int32_c_array(buf)
        attack_base = self.attack_base
        
        view2attack_buf = as_int32_c_array(self.view2attack)

        _LIB.gather_infer_action(obs_buf, hp_buf, n, height, width, n_channel,
                                 act_buf, attack_base, view2attack_buf)
        return buf
示例#5
0
文件: rush.py 项目: OwalnutO/MAgent
    def infer_action(self, observations, *args, **kwargs):
        obs_buf = as_float_c_array(observations[0])
        hp_buf  = as_float_c_array(observations[1])
        n, height, width, n_channel = observations[0].shape
        buf = np.empty((n,), dtype=np.int32)
        act_buf = as_int32_c_array(buf)
        attack_channel = self.attack_channel
        attack_base = self.attack_base
        view2attack_buf = as_int32_c_array(self.view2attack)

        _LIB.rush_prey_infer_action(obs_buf, hp_buf, n, height, width, n_channel,
                                    act_buf, attack_channel, attack_base,
                                    view2attack_buf, ctypes.c_float(100.0))
        return buf
示例#6
0
    def infer_action(self, observations, *args, **kwargs):
        obs_buf = as_float_c_array(observations[0])
        hp_buf = as_float_c_array(observations[1])
        n, height, width, n_channel = observations[0].shape
        buf = np.empty((n, ), dtype=np.int32)
        act_buf = as_int32_c_array(buf)
        attack_channel = self.attack_channel
        attack_base = self.attack_base
        view2attack_buf = as_int32_c_array(self.view2attack)

        _LIB.rush_prey_infer_action(obs_buf, hp_buf, n, height, width,
                                    n_channel, act_buf, attack_channel,
                                    attack_base, view2attack_buf,
                                    ctypes.c_float(100.0))
        return buf