Skip to content

Commit

Permalink
use .clone().detach() instead of torch.as_tensor()
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoLamberti94 authored and FrancescoConti committed Nov 15, 2021
1 parent 65dde85 commit 57d5f99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nemo/transf/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def _set_eps_in_pact(self, eps_in):
if eps_in_new is None:
continue
if (m.__class__.__name__ == "PACT_Act"):
m.eps_in = torch.tensor(eps_in_new[0], requires_grad=False)
m.eps_in = eps_in_new[0].clone().detach().requires_grad_(False)
if (m.__class__.__name__ == "PACT_QuantizedBatchNormNd"):
m.eps_in = torch.tensor(eps_in_new[0], requires_grad=False)
m.eps_in = eps_in_new[0].clone().detach().requires_grad_(False)
if (m.__class__.__name__ == "PACT_IntegerAdd"):
eps_in_list = []
for eps in eps_in_new:
Expand Down

0 comments on commit 57d5f99

Please sign in to comment.