pub struct TensorSourceRegistry { /* private fields */ }Expand description
Registry for managing tensor sources.
Tensor sources are named collections of data (e.g., “train”, “test”) that neural predicates can index into.
Implementations§
Source§impl TensorSourceRegistry
impl TensorSourceRegistry
Sourcepub fn add_with_metadata(&mut self, name: &str, metadata: TensorMetadata)
pub fn add_with_metadata(&mut self, name: &str, metadata: TensorMetadata)
Add a tensor source with metadata only (for testing without Python).
Sourcepub fn add(&mut self, name: &str, tensor: PyObject, metadata: TensorMetadata)
pub fn add(&mut self, name: &str, tensor: PyObject, metadata: TensorMetadata)
Add a tensor source with PyTorch tensor.
Sourcepub fn set_active(&mut self, name: &str) -> Result<(), TensorSourceError>
pub fn set_active(&mut self, name: &str) -> Result<(), TensorSourceError>
Set the active tensor source.
Sourcepub fn active_name(&self) -> Option<&str>
pub fn active_name(&self) -> Option<&str>
Get the name of the active source.
Sourcepub fn active_size(&self) -> Result<usize, TensorSourceError>
pub fn active_size(&self) -> Result<usize, TensorSourceError>
Get the size of the active source.
Sourcepub fn get_active(&self) -> Result<&PyObject, TensorSourceError>
pub fn get_active(&self) -> Result<&PyObject, TensorSourceError>
Get the PyTorch tensor for the active source.
Sourcepub fn get_named(&self, name: &str) -> Result<&PyObject, TensorSourceError>
pub fn get_named(&self, name: &str) -> Result<&PyObject, TensorSourceError>
Get the PyTorch tensor for a specific named source (regardless of which
source is active). Used by the Stage-B existential-join forward, which
reads the per-event feature batch from a fixed nsr_domain source while
the per-query examples source stays active.
Sourcepub fn get_metadata(&self, name: &str) -> Option<&TensorMetadata>
pub fn get_metadata(&self, name: &str) -> Option<&TensorMetadata>
Get metadata for a specific source.
Sourcepub fn check_index(&self, index: usize) -> Result<(), TensorSourceError>
pub fn check_index(&self, index: usize) -> Result<(), TensorSourceError>
Check if an index is valid for the active source.
Sourcepub fn validate_indices(
&self,
indices: &[usize],
) -> Result<(), TensorSourceError>
pub fn validate_indices( &self, indices: &[usize], ) -> Result<(), TensorSourceError>
Validate multiple indices at once.
Sourcepub fn source_names(&self) -> Vec<String>
pub fn source_names(&self) -> Vec<String>
Get names of all sources.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &TensorMetadata)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &TensorMetadata)>
Iterate over source names and metadata.