Skip to content

Commit

Permalink
fix get_para_vector function
Browse files Browse the repository at this point in the history
  • Loading branch information
qiauil committed Sep 9, 2024
1 parent 5d0fb15 commit 33f1113
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions conflictfree/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def apply_para_vector(network:torch.nn.Module,para_vec:torch.Tensor)->None:
with torch.no_grad():
start=0
for par in network.parameters():
end=start+par.grad.data.view(-1).shape[0]
par.data=para_vec[start:end].view(par.grad.data.shape)
end=start+par.data.view(-1).shape[0]
par.data=para_vec[start:end].view(par.data.shape)
start=end

def get_cos_similarity(vector1:torch.Tensor,vector2:torch.Tensor)->torch.Tensor:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_install_requires():

setuptools.setup(
name="conflictfree",
version="0.1.2",
version="0.1.3",
author="Qiang Liu, Mengyu Chu, Nils Thuerey",
author_email="[email protected]",
description="Official implementation of Conflict-free Inverse Gradients method",
Expand Down

0 comments on commit 33f1113

Please sign in to comment.