From 23bb27956a025a85e13ec2c14861213ddd8eb2f0 Mon Sep 17 00:00:00 2001 From: Jeremy Reizenstein Date: Tue, 11 Feb 2020 15:14:42 -0800 Subject: [PATCH] remove print statements Reviewed By: gkioxari Differential Revision: D19834684 fbshipit-source-id: 553dbf84d1062149b4915d313fc0f96eb047798c --- pytorch3d/renderer/utils.py | 3 ++- pytorch3d/transforms/transform3d.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pytorch3d/renderer/utils.py b/pytorch3d/renderer/utils.py index d2024d34..5ffd4c37 100644 --- a/pytorch3d/renderer/utils.py +++ b/pytorch3d/renderer/utils.py @@ -3,6 +3,7 @@ import numpy as np +import warnings from typing import Any, Union import torch @@ -111,7 +112,7 @@ class TensorProperties(object): args_to_broadcast[k] = v else: msg = "Arg %s with type %r is not broadcastable" - print(msg % (k, type(v))) + warnings.warn(msg % (k, type(v))) names = args_to_broadcast.keys() # convert from type dict.values to tuple diff --git a/pytorch3d/transforms/transform3d.py b/pytorch3d/transforms/transform3d.py index 5c59859b..c0483513 100644 --- a/pytorch3d/transforms/transform3d.py +++ b/pytorch3d/transforms/transform3d.py @@ -2,6 +2,7 @@ # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import math +import warnings import torch @@ -663,7 +664,7 @@ def _check_valid_rotation_matrix(R, tol: float = 1e-7): Returns: None - Prints an warning if R is an invalid rotation matrix. Else return. + Emits a warning if R is an invalid rotation matrix. """ N = R.shape[0] eye = torch.eye(3, dtype=R.dtype, device=R.device) @@ -673,5 +674,5 @@ def _check_valid_rotation_matrix(R, tol: float = 1e-7): no_distortion = torch.allclose(det_R, torch.ones_like(det_R)) if not (orthogonal and no_distortion): msg = "R is not a valid rotation matrix" - print(msg) + warnings.warn(msg) return