(shape: &[usize], seed: u64)
| 420 | use candle_core::{DType, Device, IndexOp}; |
| 421 | |
| 422 | fn mt(shape: &[usize], seed: u64) -> Tensor { |
| 423 | use rand::{Rng, SeedableRng}; |
| 424 | let n: usize = shape.iter().product(); |
| 425 | let mut rng = rand::rngs::StdRng::seed_from_u64(seed); |
| 426 | let d: Vec<f32> = (0..n).map(|_| rng.gen_range(-0.01..0.01)).collect(); |
| 427 | Tensor::from_vec(d, shape, &Device::Cpu).unwrap() |
| 428 | } |
| 429 | |
| 430 | #[test] |
| 431 | fn test_encoder_block_forward() { |
no outgoing calls