Expand description
Tensor Source Registry
This module manages external tensor data (images, embeddings, etc.) that can be indexed by neural predicates during proof search.
§Architecture
In DeepProbLog-style programs, neural predicates reference external data:
nn(mnist_net, [X], Y, [0..9]) :: digit(X, Y).
?- digit(42, Y). // X=42 indexes into tensor sourceThe tensor source registry:
- Stores named tensor sources (train, test, etc.)
- Tracks the “active” source for current evaluation
- Validates indices are within bounds
- Holds PyTorch tensors via PyO3 (when
pythonfeature enabled)
§Usage
use xlog_neural::tensor_source::{TensorSourceRegistry, TensorMetadata};
let mut registry = TensorSourceRegistry::new();
// Add sources with metadata
registry.add_with_metadata("train", TensorMetadata::new(60000, vec![1, 28, 28]));
registry.add_with_metadata("test", TensorMetadata::new(10000, vec![1, 28, 28]));
// Set active source
registry.set_active("train").unwrap();
// Validate index before neural call
registry.check_index(42).unwrap();Structs§
- Tensor
Metadata - Metadata about a tensor source (without the actual tensor data).
- Tensor
Source Registry - Registry for managing tensor sources.
Enums§
- Tensor
Source Error - Errors from tensor source operations.