masahi commented on a change in pull request #4964: [Torch] Add initial control flow support URL: https://github.com/apache/incubator-tvm/pull/4964#discussion_r385932502
########## File path: python/tvm/relay/frontend/pytorch.py ########## @@ -614,6 +615,55 @@ def _impl(inputs, input_types): return _op.tensor.sqrt(data) return _impl +def _neg(): + def _impl(inputs, input_types): + data = inputs[0] + return _op.tensor.negative(data) + return _impl + +def _tanh(): + def _impl(inputs, input_types): + data = inputs[0] + return _op.tensor.tanh(data) + return _impl + +def _ge(): + def _impl(inputs, input_types): + assert len(inputs) == 2 + lhs = _wrap_const(inputs[0]) + rhs = _wrap_const(inputs[1]) + return _op.tensor.greater_equal(lhs, rhs) + return _impl + +def _gt(): + def _impl(inputs, input_types): + assert len(inputs) == 2 + lhs = _wrap_const(inputs[0]) + rhs = _wrap_const(inputs[1]) + return _op.tensor.greater(lhs, rhs) + return _impl + +def _lt(): + def _impl(inputs, input_types): + assert len(inputs) == 2 + lhs = _wrap_const(inputs[0]) + rhs = _wrap_const(inputs[1]) + return _op.tensor.less(lhs, rhs) + return _impl + +def _Bool(): + def _impl(inputs, input_types): + assert len(inputs) == 1 + return inputs[0] + return _impl + +def _Float(): + def _impl(inputs, input_types): + assert len(inputs) == 1 + return _op.cast(inputs[0], "float") Review comment: good catch, thanks ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services