mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-19 22:00:35 +08:00
Avoid plain division involving integers
Summary: To avoid pytorch warnings and future behaviour changes, stop using torch.div and / with tensors of integers. Reviewed By: gkioxari, mruberry Differential Revision: D21857955 fbshipit-source-id: fb9f3000f3d953352cdc721d2a5f73d3a4bbf4b7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
40b068e4bc
commit
5444c53cee
@@ -24,11 +24,8 @@ DEBUG = False # Set DEBUG to true to save outputs from the tests.
|
||||
def convert_image_to_binary_mask(filename):
|
||||
with Image.open(filename) as raw_image:
|
||||
image = torch.from_numpy(np.array(raw_image))
|
||||
min = image.min()
|
||||
max = image.max()
|
||||
image_norm = (image - min) / (max - min)
|
||||
image_norm[image_norm > 0] == 1.0
|
||||
image_norm = image_norm.to(torch.int64)
|
||||
mx = image.max()
|
||||
image_norm = (image == mx).to(torch.int64)
|
||||
return image_norm
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user