xtructure.queue package

Submodules

xtructure.queue.queue module

class xtructure.queue.queue.Queue(max_size: int, val_store: Xtructurable, head: uint32, tail: uint32)[source]

Bases: object

A JAX-compatible batched Queue data structure. Optimized for parallel operations on GPU using JAX.

max_size

Maximum number of elements the queue can hold.

Type:

int

val_store

Array storing the values in the queue.

Type:

xtructure.core.protocol.Xtructurable

head

Index of the first item in the queue.

Type:

jax.numpy.uint32

tail

Index of the next available slot.

Type:

jax.numpy.uint32

static build(max_size: int, value_class: Xtructurable)[source]

Creates a new Queue instance.

clear()[source]

Clears the queue.

dequeue(num_items: int = 1)[source]

Dequeues a number of items from the queue.

enqueue(items: Xtructurable)[source]

Enqueues a number of items into the queue.

from_tuple()
head: uint32
max_size: int
peek(num_items: int = 1)[source]

Peeks at the front items of the queue without removing them.

replace(**kwargs)
property size
tail: uint32
to_tuple()
val_store: Xtructurable

Module contents

class xtructure.queue.Queue(max_size: int, val_store: Xtructurable, head: uint32, tail: uint32)[source]

Bases: object

A JAX-compatible batched Queue data structure. Optimized for parallel operations on GPU using JAX.

max_size

Maximum number of elements the queue can hold.

Type:

int

val_store

Array storing the values in the queue.

Type:

xtructure.core.protocol.Xtructurable

head

Index of the first item in the queue.

Type:

jax.numpy.uint32

tail

Index of the next available slot.

Type:

jax.numpy.uint32

static build(max_size: int, value_class: Xtructurable)[source]

Creates a new Queue instance.

clear()[source]

Clears the queue.

dequeue(num_items: int = 1)[source]

Dequeues a number of items from the queue.

enqueue(items: Xtructurable)[source]

Enqueues a number of items into the queue.

from_tuple()
head: uint32
max_size: int
peek(num_items: int = 1)[source]

Peeks at the front items of the queue without removing them.

replace(**kwargs)
property size
tail: uint32
to_tuple()
val_store: Xtructurable