diff --git a/returnn/tensor/_dim_extra.py b/returnn/tensor/_dim_extra.py index 4635e79fc9..74dc18472f 100644 --- a/returnn/tensor/_dim_extra.py +++ b/returnn/tensor/_dim_extra.py @@ -1184,6 +1184,8 @@ def _bin_op_tf(a, b): elif kind in ("floordiv", "truediv"): # truediv assumes there is no remainder return a // b elif kind == "ceildiv": + if util.is_onnx_export_global(): + return -tf_util.onnx_compat_floor_div(-a, b) return -(-a // b) else: raise ValueError("unknown op kind %r" % op.kind)