style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)
Whole-workspace rustfmt pass picked up while iterating on Mamba GPU backward work. Verified formatting-only via diff sampling; no logic changed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -4,20 +4,22 @@
|
||||
//! supporting both homogeneous and heterogeneous graphs with batch processing.
|
||||
|
||||
use crate::Result;
|
||||
use rtx_tensor::{Tensor, Device};
|
||||
use rtx_tensor::{Device, Tensor};
|
||||
|
||||
pub mod graph_transformer_simple;
|
||||
pub mod graph_attention_simple;
|
||||
pub mod graph_pooling_simple;
|
||||
pub mod graph_transformer_simple;
|
||||
pub mod positional_encoding_simple;
|
||||
|
||||
#[cfg(all(test, feature = "disabled_tests"))]
|
||||
pub mod graph_transformer_tests;
|
||||
|
||||
pub use graph_transformer_simple::{GraphTransformer, GraphTransformerConfig, GraphOutput};
|
||||
pub use graph_attention_simple::{GraphAttention, GraphAttentionConfig, AttentionOutput};
|
||||
pub use graph_pooling_simple::{GraphPooling, GlobalPooling, HierarchicalPooling, Set2SetPooling, AttentionPooling};
|
||||
pub use positional_encoding_simple::{GraphPositionalEncoding, GraphPEConfig, GraphPEType};
|
||||
pub use graph_attention_simple::{AttentionOutput, GraphAttention, GraphAttentionConfig};
|
||||
pub use graph_pooling_simple::{
|
||||
AttentionPooling, GlobalPooling, GraphPooling, HierarchicalPooling, Set2SetPooling,
|
||||
};
|
||||
pub use graph_transformer_simple::{GraphOutput, GraphTransformer, GraphTransformerConfig};
|
||||
pub use positional_encoding_simple::{GraphPEConfig, GraphPEType, GraphPositionalEncoding};
|
||||
|
||||
/// Graph data structure for batch processing
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -46,7 +48,7 @@ impl GraphBatch {
|
||||
device: Device,
|
||||
) -> Result<Self> {
|
||||
let batch_size = graph_boundaries.len().saturating_sub(1);
|
||||
|
||||
|
||||
Ok(Self {
|
||||
node_features,
|
||||
edge_features,
|
||||
@@ -56,17 +58,17 @@ impl GraphBatch {
|
||||
device,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/// Get the number of nodes in the batch
|
||||
pub fn num_nodes(&self) -> usize {
|
||||
self.node_features.shape().dims()[0]
|
||||
}
|
||||
|
||||
|
||||
/// Get the number of edges in the batch
|
||||
pub fn num_edges(&self) -> usize {
|
||||
self.edge_features.shape().dims()[0]
|
||||
}
|
||||
|
||||
|
||||
/// Check if batch is homogeneous (all graphs have same structure)
|
||||
pub fn is_homogeneous(&self) -> bool {
|
||||
// For now, assume heterogeneous - can be optimized later
|
||||
@@ -115,16 +117,16 @@ pub enum PoolingStrategy {
|
||||
pub trait GraphLayer: Send + Sync {
|
||||
/// Forward pass through the graph layer
|
||||
fn forward(&self, graph: &GraphBatch) -> Result<GraphOutput>;
|
||||
|
||||
|
||||
/// Get the layer type name
|
||||
fn layer_type(&self) -> &'static str;
|
||||
|
||||
|
||||
/// Get the device this layer is on
|
||||
fn device(&self) -> &Device;
|
||||
|
||||
|
||||
/// Get layer parameters for optimization
|
||||
fn parameters(&self) -> Vec<&Tensor>;
|
||||
|
||||
|
||||
/// Get mutable layer parameters for optimization
|
||||
fn parameters_mut(&mut self) -> Vec<&mut Tensor>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user