def _teacher_action(self, obs, ended):
    '\n        Extract teacher actions into variable.\n        :param obs: The observation.\n        :param ended: Whether the action seq is ended\n        :return:\n        '
    a = np.zeros(len(obs), dtype=np.int64)
    for (i, ob) in enumerate(obs):
        if ended[i]:
            a[i] = args.ignoreid
        else:
            for (k, candidate) in enumerate(ob['candidate']):
                if (candidate['viewpointId'] == ob['teacher']):
                    a[i] = k
                    break
            else:
                assert (ob['teacher'] == ob['viewpoint'])
                a[i] = len(ob['candidate'])
    return torch.from_numpy(a).cuda()
Extract teacher actions into variable.
:param obs: The observation.
:param ended: Whether the action seq is ended
:return:
def _teacher_action(self, obs, ended):
    '\n        Extract teacher actions into variable.\n        :param obs: The observation.\n        :param ended: Whether the action seq is ended\n        :return:\n        '
    a = np.zeros(len(obs), dtype=np.int64)
    for (i, ob) in enumerate(obs):
        if ended[i]:
            a[i] = args.ignoreid
        else:
            for (k, candidate) in enumerate(ob['candidate']):
                if (candidate['viewpointId'] == ob['teacher']):
                    a[i] = k
                    break
            else:
                assert (ob['teacher'] == ob['viewpoint'])
                a[i] = len(ob['candidate'])
    return torch.from_numpy(a).cuda()