Skip to content

Commit

Permalink
add torch.device support for quantization (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonn-zh committed Mar 22, 2023
1 parent 405b39c commit 02fc608
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MinkowskiEngine/utils/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ def sparse_quantize(
else:
discrete_coordinates = discrete_coordinates.int()

if device == "cpu":
if (type(device) == str and device == "cpu") or (type(device) == torch.device and device.type == "cpu"):
manager = MEB.CoordinateMapManagerCPU()
elif "cuda" in device:
elif (type(device) == str and "cuda" in device) or (type(device) == torch.device and device.type == "cuda"):
manager = MEB.CoordinateMapManagerGPU_c10()
else:
raise ValueError("Invalid device. Only `cpu` or `cuda` supported.")
raise ValueError("Invalid device. Only `cpu`, `cuda` or torch.device supported.")

# Return values accordingly
if use_label:
Expand Down

0 comments on commit 02fc608

Please sign in to comment.