I tried code the sample in colab:
@tf.py_function(Tout=tf.float32)
def py_log_huber(x, m):
print(‘Running with eager execution.’)
if tf.abs(x) <= m:
return x2
else:
return m2 * (1 - 2 * tf.math.log(m) + tf.math.log(x**2))
TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 @tf.py_function(Tout=tf.float32)
2 def py_log_huber(x, m):
3 print(‘Running with eager execution.’)
4 if tf.abs(x) <= m:
5 return x**2
/usr/local/lib/python3.10/dist-packages/tensorflow/python/util/dispatch.py in op_dispatch_handler(*args, **kwargs)
1168 if iterable_params is not None:
1169 args, kwargs = replace_iterable_params(args, kwargs, iterable_params)
→ 1170 result = api_dispatcher.Dispatch(args, kwargs)
1171 if result is not NotImplemented:
1172 return result
TypeError: Missing required positional argument