summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-03-04 13:29:07 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-03-04 13:29:07 +0800
commit8578a141969720ec93b9bc172c8f20d0ef66ed16 (patch)
treed55b069a4cf5ab2fd327e2ff5a3d4463be4a3970 /models
parent96c1f9fa2fc747ff3c54c7f06e65706ce27fccfd (diff)
Replace detach with no_grad in evaluation
Diffstat (limited to 'models')
-rw-r--r--models/model.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/model.py b/models/model.py
index 83b970a..7aff6c4 100644
--- a/models/model.py
+++ b/models/model.py
@@ -423,7 +423,8 @@ class Model:
def _get_eval_sample(self, sample: dict[str, Union[list, torch.Tensor]]):
label = sample.pop('label').item()
clip = sample.pop('clip').to(self.device)
- feature = self.rgb_pn(clip).detach()
+ with torch.no_grad():
+ feature = self.rgb_pn(clip)
return {
**{'label': label},
**sample,