style: apply rustfmt across all crates and demos
Consistent formatting pass: line wrapping, import sorting, trailing whitespace removal, let-chain indentation, merged derive attributes, and unsafe block reformatting. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
//! Implements a transformer-based model for learning cell representations
|
||||
//! from sparse gene expression data.
|
||||
|
||||
|
||||
/// Configuration for the Cell Transformer.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CellTransformerConfig {
|
||||
@@ -53,7 +52,7 @@ pub struct CellTransformer {
|
||||
|
||||
impl CellTransformer {
|
||||
/// Create a new Cell Transformer with random initialization.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new(config: CellTransformerConfig) -> Self {
|
||||
use rand::SeedableRng;
|
||||
use rand_distr::{Distribution, Normal};
|
||||
@@ -89,7 +88,7 @@ impl CellTransformer {
|
||||
}
|
||||
|
||||
/// Encode a batch of cells into embeddings.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn encode(&self, gene_indices: &[Vec<usize>], values: &[Vec<f32>]) -> Vec<Vec<f32>> {
|
||||
let batch_size = gene_indices.len();
|
||||
let mut embeddings = Vec::with_capacity(batch_size);
|
||||
@@ -132,7 +131,7 @@ impl CellTransformer {
|
||||
}
|
||||
|
||||
/// Get the hidden dimension.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn hidden_dim(&self) -> usize {
|
||||
self.config.hidden_dim
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user