t-vi commented on a change in pull request #10091:
URL: https://github.com/apache/tvm/pull/10091#discussion_r794290423
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1755,7 +1765,8 @@ def pad(inputs, input_types):
return pad
- def clamp(self, inputs, input_types):
+ def clamp_common(self, inputs, min_only=False, max_only=False):
Review comment:
I wonder if it makes sense to instead pass `None` as inputs, as
currently done in the code (and in TorchScript) when you script `clamp`.
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1769,10 +1780,27 @@ def get_v(v, default_v):
return v
return default_v
- amin = get_v(inputs[1], np.finfo(np.float32).min)
- amax = get_v(inputs[2], np.finfo(np.float32).max)
+ if min_only:
+ amin = get_v(inputs[1], np.finfo(np.float32).min)
Review comment:
It is not introduced in this PR, but is using float32's max prudent
here? We might have all sorts of dtypes as inputs, also `-inf` should probably
not be clamped to `-3.4028235e+38`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]