- 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
21 lines
598 B
Rust
21 lines
598 B
Rust
use super::*;
|
|
use burn_tensor::TensorData;
|
|
|
|
#[test]
|
|
fn should_diff_round() {
|
|
let data = TensorData::from([
|
|
[-1.9751, 0.0714, 0.0643, 0.2406],
|
|
[-1.3172, 0.1252, -0.1119, -0.0127],
|
|
]);
|
|
let device = Default::default();
|
|
let tensor_1 = TestAutodiffTensor::<2>::from_data(data.clone(), &device).require_grad();
|
|
let tensor_2 = tensor_1.clone().round();
|
|
let grads = tensor_2.backward();
|
|
|
|
let grad_1 = tensor_1.grad(&grads).unwrap();
|
|
grad_1.to_data().assert_eq(
|
|
&TensorData::from([[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]),
|
|
false,
|
|
);
|
|
}
|