feat: update workspace paths and enhance gitignore
- Updated stablediffusion crate path from "../stable-diffusion-burn" to "./crates/stable-diffusion-burn" for proper workspace resolution - Enhanced .gitignore to include generated model files (.mpk, .pt, .bin, .safetensors, .ckpt) and user_data directory - Added Cargo.lock to gitignore with appropriate comment - Reorganized IDE files section in gitignore for better clarity - Added newline at end of file for proper formatting
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
use super::*;
|
||||
|
||||
use serial_test::serial;
|
||||
|
||||
use core::f32;
|
||||
|
||||
use burn_tensor::{Distribution, Shape, Tensor, backend::Backend};
|
||||
|
||||
use cubek::random::{assert_number_of_1_proportional_to_prob, assert_wald_wolfowitz_runs_test};
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn number_of_1_proportional_to_prob() {
|
||||
let device = Default::default();
|
||||
TestBackend::seed(&device, 0);
|
||||
|
||||
let shape: Shape = [40, 40].into();
|
||||
let prob = 0.7;
|
||||
|
||||
let tensor =
|
||||
Tensor::<TestBackend, 2>::random(shape.clone(), Distribution::Bernoulli(prob), &device)
|
||||
.into_data();
|
||||
|
||||
let numbers = tensor
|
||||
.as_slice::<<TestBackend as Backend>::FloatElem>()
|
||||
.unwrap();
|
||||
|
||||
assert_number_of_1_proportional_to_prob(numbers, prob as f32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn wald_wolfowitz_runs_test() {
|
||||
let device = Default::default();
|
||||
TestBackend::seed(&device, 0);
|
||||
|
||||
let shape = Shape::new([512, 512]);
|
||||
let device = Default::default();
|
||||
let tensor = Tensor::<TestBackend, 2>::random(shape, Distribution::Bernoulli(0.5), &device);
|
||||
|
||||
let data = tensor.into_data();
|
||||
let numbers = data
|
||||
.as_slice::<<TestBackend as Backend>::FloatElem>()
|
||||
.unwrap();
|
||||
|
||||
// High bound slightly over 1 so 1.0 is included in second bin
|
||||
assert_wald_wolfowitz_runs_test(numbers, 0., 1.1);
|
||||
}
|
||||
Reference in New Issue
Block a user