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,24 @@
|
||||
use super::*;
|
||||
use burn_tensor::{Distribution, activation};
|
||||
|
||||
#[test]
|
||||
fn should_update_tensor_when_grad_replace() {
|
||||
let device = Default::default();
|
||||
let tensor_1 =
|
||||
TestAutodiffTensor::<2>::random([32, 32], Distribution::Default, &device).require_grad();
|
||||
let tensor_2 = TestAutodiffTensor::random([32, 32], Distribution::Default, &device);
|
||||
|
||||
let x = tensor_1.clone().matmul(activation::gelu(tensor_2));
|
||||
let mut grads = x.backward();
|
||||
|
||||
let grad_1 = tensor_1.grad(&grads).unwrap();
|
||||
|
||||
let grad_1_updated =
|
||||
TestAutodiffTensor::random([32, 32], Distribution::Default, &device).require_grad();
|
||||
tensor_1.grad_replace(&mut grads, grad_1_updated.clone().inner());
|
||||
|
||||
let grad_1_new = tensor_1.grad(&grads).unwrap();
|
||||
|
||||
assert_ne!(grad_1_new.to_data(), grad_1.into_data());
|
||||
assert_eq!(grad_1_new.into_data(), grad_1_updated.into_data());
|
||||
}
|
||||
Reference in New Issue
Block a user