def _run_parallel(self, program, scope, feed, fetch_list, fetch_var_name, return_numpy):
    exe = program._executor
    if isinstance(feed, dict):
        feed_tensor_dict = dict()
        for feed_name in feed:
            feed_tensor = feed[feed_name]
            if (not isinstance(feed_tensor, core.LoDTensor)):
                feed_tensor = core.LoDTensor()
                feed_tensor.set(feed[feed_name], core.CPUPlace())
            feed_tensor_dict[feed_name] = feed_tensor
        exe.feed_and_split_tensor_into_local_scopes(feed_tensor_dict)
    elif (isinstance(feed, list) or isinstance(feed, tuple)):
        if (len(feed) != len(program._places)):
            raise ValueError('Feed a list of tensor, the list should be the same size as places')
        res = list()
        for (i, each) in enumerate(feed):
            if (not isinstance(each, dict)):
                raise TypeError('Each element of feed list should be a dict')
            res_dict = dict()
            for feed_name in each:
                tensor = each[feed_name]
                if (not isinstance(tensor, core.LoDTensor)):
                    tmp = core.LoDTensor()
                    tmp.set(tensor, program._places[i])
                    tensor = tmp
                res_dict[feed_name] = tensor
            res.append(res_dict)
        exe.feed_tensors_into_local_scopes(res)
    fetch_var_names = list(map(_to_name_str, fetch_list))
    exe.run(fetch_var_names, fetch_var_name)
    arr = scope.find_var(fetch_var_name).get_lod_tensor_array()
    if return_numpy:
        return as_numpy(arr)
    return [arr[i] for i in range(len(arr))]
def _run_parallel(self, program, scope, feed, fetch_list, fetch_var_name, return_numpy):
    exe = program._executor
    if isinstance(feed, dict):
        feed_tensor_dict = dict()
        for feed_name in feed:
            feed_tensor = feed[feed_name]
            if (not isinstance(feed_tensor, core.LoDTensor)):
                feed_tensor = core.LoDTensor()
                feed_tensor.set(feed[feed_name], core.CPUPlace())
            feed_tensor_dict[feed_name] = feed_tensor
        exe.feed_and_split_tensor_into_local_scopes(feed_tensor_dict)
    elif (isinstance(feed, list) or isinstance(feed, tuple)):
        if (len(feed) != len(program._places)):
            raise ValueError('Feed a list of tensor, the list should be the same size as places')
        res = list()
        for (i, each) in enumerate(feed):
            if (not isinstance(each, dict)):
                raise TypeError('Each element of feed list should be a dict')
            res_dict = dict()
            for feed_name in each:
                tensor = each[feed_name]
                if (not isinstance(tensor, core.LoDTensor)):
                    tmp = core.LoDTensor()
                    tmp.set(tensor, program._places[i])
                    tensor = tmp
                res_dict[feed_name] = tensor
            res.append(res_dict)
        exe.feed_tensors_into_local_scopes(res)
    fetch_var_names = list(map(_to_name_str, fetch_list))
    exe.run(fetch_var_names, fetch_var_name)
    arr = scope.find_var(fetch_var_name).get_lod_tensor_array()
    if return_numpy:
        return as_numpy(arr)
    return [arr[i] for i in range(len(arr))]