Skip to main content

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

Release files for replay-memory 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for replay-memory 0.2.0
File Size Uploaded
replay_memory-0.2.0.tar.gz 4.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for replay-memory 0.2.0
File Interpreter ABI Platform
replay_memory-0.2.0-cp36-abi3-manylinux_2_28_x86_64.whl CPython 3.6 abi3 Linux glibc 2.28+ x86-64 Details
replay_memory-0.2.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl CPython 3.6 abi3 macOS 10.9+ x86-64, macOS 10.9+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size: 691.8 kB

Release files / replay_memory-0.2.0.tar.gz

Download URL replay_memory-0.2.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d59c693405278fba0e8bebf5f657458e38d9a9451ae6c19ee3479fe10ddc45d8
BLAKE2b-256 checksum
How to use checksums
9609eb6cc4c5f6f13ed68793a70588a10e8a8722163dacbe676f7566b90ce790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.12.6

Release files / replay_memory-0.2.0-cp36-abi3-manylinux_2_28_x86_64.whl

Download URL replay_memory-0.2.0-cp36-abi3-manylinux_2_28_x86_64.whl
Size 205.3 kB
Tags CPython 3.6 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d9bf8da4c36836d9267bce6fdbf2219c0c4b7c9dc54fd35fcfab4bae84b63f91
BLAKE2b-256 checksum
How to use checksums
f6a288d38471c33db80406480e765285c7e27631ab55e8ad7fe65dcf3e29ca44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.12.6

Release files / replay_memory-0.2.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl

Download URL replay_memory-0.2.0-cp36-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Size 481.9 kB
Tags CPython 3.6 abi3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ac220217f8fc69681bb382711847ec8031fcd81278d09e23e4d959797dfdbd97
BLAKE2b-256 checksum
How to use checksums
9ff7e006d672b7783525ae08932a0dbaa8e6bcad2a4b7564362a5c00bd2c97b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.12.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

3 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page