No project description provided
Project description
Replay Memory
Simple replay memory data structure implemented using a ring buffer in Rust. Intended to be used for reinforcement learning.
Installation
pip install replay_memory
Usage
>>> import replay_memory
>>> rm = replay_memory.ReplayMemory(10) # set capacity to 10
>>> rm.push_items(range(21))
>>> rm[0] # show has overwritten oldest data
20
>>> len(rm) # length unchanged
10
>>> rm.sample(3) # get a randomly selected sample of 3 items
[20, 18, 11]
>>> rm.sample(3)
[12, 18, 16]
Development
Package is written in rust using PyO3 and maturin.
Unit tests
Rust unit tests can be run as below:
cargo test --no-default-features
Python unit tests are run using tox:
tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
replay_memory-0.2.0.tar.gz
(4.6 kB
view hashes)
Built Distributions
Close
Hashes for replay_memory-0.2.0-cp36-abi3-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9bf8da4c36836d9267bce6fdbf2219c0c4b7c9dc54fd35fcfab4bae84b63f91 |
|
MD5 | 625799f85108c237591580cf35e552c0 |
|
BLAKE2b-256 | f6a288d38471c33db80406480e765285c7e27631ab55e8ad7fe65dcf3e29ca44 |
Close
Hashes for replay_memory-0.2.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac220217f8fc69681bb382711847ec8031fcd81278d09e23e4d959797dfdbd97 |
|
MD5 | 4d90ffc1a58cc9445297b61091276bfc |
|
BLAKE2b-256 | 9ff7e006d672b7783525ae08932a0dbaa8e6bcad2a4b7564362a5c00bd2c97b6 |