コード例 #1
0
def create_bounds(name):
    if name == "scalars":
        return lambda: Bounds(high=5, low=-5, shape=(3, ))
    elif name == "high_array":
        return lambda: Bounds(high=numpy.array([1, 2, 5]), low=-5)
    elif name == "low_array":
        return lambda: Bounds(low=numpy.array([-1, -5, -3]), high=5)
    elif name == "both_array":
        array = numpy.array([1, 2, 5])
        return lambda: Bounds(high=array, low=-array)
    elif name == "high_list":
        return lambda: Bounds(low=numpy.array([-5, -2, -3]), high=[5, 5, 5])
コード例 #2
0
ファイル: test_env.py プロジェクト: vmarkovtsev/fragile
 def function_env():
     bounds = Bounds(shape=(2, ), high=1, low=1, dtype=int)
     env = Function(function=lambda x: np.ones(N_WALKERS), bounds=bounds)
     params = {
         "actions": {
             "dtype": np.int64,
             "size": (2, )
         },
         "dt": {
             "dtype": np.float32
         }
     }
     states = States(state_dict=params, batch_size=N_WALKERS)
     return env, states