Java教程

sample_by_num

本文主要是介绍sample_by_num,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
def sample_by_num(data_dict: dict, num: int):
    """
    Sample num trajs from data_dict.
    """
    samples = {}
    for k, v in data_dict.items():
        if k == "index":
            samples[k] = v[0: num]
        else:
            samples[k] = v[0: int(data_dict["index"][num])]

    return samples

from:
offlinerl/neorl
这篇关于sample_by_num的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!