33 lines
955 B
Rust
33 lines
955 B
Rust
//! TDD tests for tensor indexing operations
|
|
//! These tests define expected behavior for tensor slicing
|
|
|
|
use rtx_tensor::{Device, Tensor};
|
|
|
|
#[test]
|
|
fn test_tensor_column_slicing() {
|
|
// We need to slice columns from a 2D tensor
|
|
// In PyTorch: tensor[:, i] gets column i
|
|
// In rtx-tensor: we might need to use slice or index_select
|
|
|
|
let device = Device::cpu();
|
|
let tensor = Tensor::zeros(&[10, 5], &device).unwrap();
|
|
|
|
// To get column 2 (all rows, column 2):
|
|
// We need to slice dimension 1 from index 2 to 3
|
|
// tensor.slice(1, 2, 3) would give us a [10, 1] tensor
|
|
|
|
assert!(true); // Placeholder - actual test would verify slicing
|
|
}
|
|
|
|
#[test]
|
|
fn test_tensor_row_slicing() {
|
|
// Test slicing rows from tensor
|
|
let device = Device::cpu();
|
|
let tensor = Tensor::zeros(&[10, 5], &device).unwrap();
|
|
|
|
// To get row 3:
|
|
// tensor.slice(0, 3, 4) would give us a [1, 5] tensor
|
|
|
|
assert!(true); // Placeholder
|
|
}
|