71 lines
2.2 KiB
Rust
71 lines
2.2 KiB
Rust
//! TDD tests for global rtx-vision exports
|
|
//! These tests define expected behavior for importing vision types from the root crate
|
|
|
|
use rtx_vision::{
|
|
// Core architecture types that should be available globally
|
|
Device,
|
|
// Global components that should be re-exported
|
|
GlobalResponseNormalization,
|
|
MAEDecoder,
|
|
MAEEncoder,
|
|
SEModule,
|
|
SEModuleConfig,
|
|
Tensor,
|
|
|
|
// Architecture modules should be accessible
|
|
architectures,
|
|
};
|
|
|
|
#[test]
|
|
fn test_core_types_available() {
|
|
// Test that core types can be imported from root
|
|
let device = Device::default();
|
|
match device {
|
|
Device::Cpu => assert!(true),
|
|
_ => assert!(true), // Other devices also valid
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_architecture_module_accessible() {
|
|
// Test that architecture module is accessible
|
|
let config = architectures::MobileNetConfig::default();
|
|
assert_eq!(config.num_classes, 1000);
|
|
}
|
|
|
|
#[test]
|
|
fn test_global_components_importable() {
|
|
// Test that global components can be imported directly from crate root
|
|
let device = Device::default();
|
|
|
|
// GlobalResponseNormalization should be available
|
|
let _grn = GlobalResponseNormalization::new(64, 1e-6, &device);
|
|
|
|
// MAE components should be available
|
|
let _mae_encoder = MAEEncoder::new(384, 196, 16);
|
|
let _mae_decoder = MAEDecoder::new(384, 512, 16);
|
|
|
|
// SE Module should be available (using mobile_components version with reduction_ratio)
|
|
let se_config = SEModuleConfig {
|
|
channels: 64,
|
|
reduction_ratio: 0.25,
|
|
};
|
|
let _se_module = SEModule::new(se_config, device.clone());
|
|
}
|
|
|
|
#[test]
|
|
fn test_preprocessing_types() {
|
|
// Test that preprocessing components work with correct tensor operations
|
|
let device = Device::default();
|
|
let tensor1 = Tensor::zeros(&[1, 3, 224, 224], &device).unwrap();
|
|
let tensor2 = Tensor::zeros(&[1, 3, 224, 224], &device).unwrap();
|
|
|
|
// Should be able to concatenate tensors
|
|
let tensors = vec![tensor1, tensor2];
|
|
let _stacked = Tensor::cat(&tensors, 0);
|
|
|
|
// Should be able to create tensor with proper device parameter
|
|
let shape = vec![1, 3, 224, 224];
|
|
let _new_tensor = Tensor::randn(&shape, &device);
|
|
}
|