Commit 93037c4e authored by Yang Liu's avatar Yang Liu Committed by Facebook GitHub Bot
Browse files

Fix cpu().detach() into detach().cpu()

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/619

For visualisation, tensor variables should be detached from the computational graph. The .cpu() function call should be after the detach().

Reviewed By: frabu6, wat3rBro

Differential Revision: D48737228

fbshipit-source-id: b7308c852bdbae89fddba088f5188f61a9a216a8
parent d49077dd
...@@ -58,7 +58,7 @@ class VisualizerWrapper(object): ...@@ -58,7 +58,7 @@ class VisualizerWrapper(object):
if hasattr(self._get_meta_arch_class(), "visualize_train_input"): if hasattr(self._get_meta_arch_class(), "visualize_train_input"):
return self._get_meta_arch_class().visualize_train_input(self, input_dict) return self._get_meta_arch_class().visualize_train_input(self, input_dict)
img = per_image["image"].permute(1, 2, 0).cpu().detach().numpy() img = per_image["image"].permute(1, 2, 0).detach().cpu().numpy()
img = utils.convert_image_to_rgb(img, cfg.INPUT.FORMAT) img = utils.convert_image_to_rgb(img, cfg.INPUT.FORMAT)
if "dataset_name" in input_dict: if "dataset_name" in input_dict:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment