コード例 #1
0
def test_save():
    perfplot.save(
        "out.png",
        setup=np.random.rand,
        kernels=kernels,
        n_range=r,
        xlabel="len(a)",
        relative_to=0,
    )
コード例 #2
0
ファイル: perfplot_test.py プロジェクト: Abhirup-pik/perfplot
def test_save():
    perfplot.save(
        "out.png",
        setup=numpy.random.rand,
        kernels=kernels,
        n_range=r,
        xlabel="len(a)",
        title="mytest",
    )
    return
コード例 #3
0
def test_save():
    def mytest(a):
        return numpy.c_[a, a]
    kernels = [mytest]
    r = [2**k for k in range(4)]
    perfplot.save(
            'out.png',
            setup=numpy.random.rand,
            kernels=kernels, n_range=r,
            xlabel='len(a)', title='mytest'
            )
    return
コード例 #4
0
def test_save():
    def mytest(a):
        return numpy.c_[a, a]

    kernels = [mytest]
    r = [2**k for k in range(4)]

    perfplot.save(
        "out.png",
        setup=numpy.random.rand,
        kernels=kernels,
        n_range=r,
        xlabel="len(a)",
        title="mytest",
    )
    return
コード例 #5
0
import perfplot
import scipy.fftpack
import pyfftw

# numpy.use_fastnumpy = True

perfplot.save(
    "rfftperf.png",
    transparent=False,
    setup=lambda n:
    (numpy.random.rand(int(n))),  # or simply setup=numpy.random.rand
    kernels=[
        lambda a: numpy.fft.rfft(a),
        lambda a: scipy.fftpack.rfft(a),
        lambda a: pyfftw.interfaces.numpy_fft.rfft(a),
    ],
    labels=["numpy", "scipy", "pyfftw"],
    n_range=[2000, 4000, 8000, 16000, 32000, 48000, 48000 * 2],
    xlabel="len(a)",
    # More optional arguments with their default values:
    title="Comparison between different rfft functions",
    # logx=False,
    # logy=False,
    equality_check=None,  # set to None to disable "correctness" assertion
    # automatic_order=True,
    # colors=None,
    # target_time_per_measurement=1.0,
    # time_unit="auto",  # set to one of ("s", "ms", "us", or "ns") to force plot units
    # relative_to=1,  # plot the timings relative to one of the measurements
)
コード例 #6
0
    """
    def sample(n):
        _rb.memory.wait_priority_after_sampling = False
        return _rb.sample(n)

    return sample


# ReplayBuffer.add
perfplot.save(filename="ReplayBuffer_add.png",
              setup = env,
              time_unit="ms",
              kernels = [add_b(brb),
                         add_r(rrb),
                         add_c(crb),
                         lambda e: rb.add(**e)],
              labels = ["OpenAI/Baselines","Ray/RLlib","Chainer/ChainerRL","cpprb"],
              n_range = [n for n in range(1,102,10)],
              xlabel = "Step size added at once",
              title = "Replay Buffer Add Speed",
              logx = False,
              logy = False,
              equality_check = None)


# Fill Buffers
for _ in range(buffer_size):
    o = np.random.rand(obs_shape) # [0,1)
    a = np.random.rand(act_shape)
    r = np.random.rand(1)
    d = np.random.randint(2) # [0,2) == 0 or 1
    brb.add(obs_t=o,action=a,reward=r,obs_tp1=o,done=d)