Files
rustytorch/crates/specialized/rtx-science/tests/boundary_compute_loss_test.rs
T
2026-03-04 00:08:42 +00:00

29 lines
907 B
Rust

//! TDD tests for BoundaryData compute_loss method
//! Following strict TDD approach - defining expected behavior
use rtx_science::physics::{BoundaryData, PINN};
use rtx_science::types::Variable;
use rtx_tensor::{Device, Tensor};
#[test]
fn test_boundary_data_compute_loss_returns_f32() {
// BoundaryData::compute_loss should return f32, not Variable
// This matches the pattern where mean_square() returns f32
let device = Device::cpu();
let coordinates = Tensor::zeros(&[10, 2], &device).unwrap();
let values = Tensor::zeros(&[10], &device).unwrap();
let weights = Tensor::ones(&[10], &device).unwrap();
let boundary_data = BoundaryData {
coordinates,
values,
bc_types: vec![],
weights,
metadata: Default::default(),
};
// The compute_loss should return f32 for consistency
// This test defines the expected interface
}