Last active
August 7, 2026 18:09
-
-
Save mcollinswisc/7cc504381d6c30ee50ef72745f47c6e5 to your computer and use it in GitHub Desktop.
Comparison of bit shift implementations (ONNX, numpy, torch, jax, mindspore)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Compare signed BitShift across NN frameworks. | |
| Comparison is to NumPy, PyTorch, JAX, TensorFlow, MindSpore and the ONNX | |
| reference evaluator. | |
| Covers the cases checked in as ONNX node tests, plus the edge and ambiguous | |
| cases deliberately left out of them (for now): negative shift amounts, shifts at | |
| or past the bit width on types the node tests do not exercise, and the extremes | |
| of each type. | |
| Setup | |
| ----- | |
| python -m venv /tmp/bitshift-venv | |
| . /tmp/bitshift-venv/bin/activate | |
| pip install numpy | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install 'jax[cpu]' | |
| pip install -e /path/to/onnx/repo # builds C++, takes a few minutes | |
| python bitshift_compare.py | |
| The editable install is what puts the signed-BitShift branch under test. Against | |
| released ONNX or the main branch, BitShift is still opset 11 and every signed | |
| case is rejected by the type constraint. | |
| TensorFlow is optional and is skipped when it is not installed. It publishes no | |
| wheels for 3.14 yet. On a newer interpreter the rest of the comparison still | |
| runs, just without TF. | |
| pip install tensorflow-cpu | |
| MindSpore is optional and is skipped when it is not installed. It requires | |
| numpy < 2, which the others have long since moved past, so it needs a venv of | |
| its own rather than a place alongside them: | |
| pip install mindspore | |
| """ | |
| from __future__ import annotations | |
| import jax | |
| import numpy as np | |
| import torch | |
| # See the module docstring: MindSpore's version bounds keep it out of the venv | |
| # the other implementations run in, so it is reported only where it is present. | |
| # It must precede onnx, because it sets PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION | |
| # on import, which has no effect once onnx has loaded protobuf's C++ backend, | |
| # and MindSpore's own generated protos fail to load under that backend. | |
| try: | |
| import mindspore | |
| except ImportError: | |
| mindspore = None | |
| import onnx | |
| import onnx.reference | |
| # TensorFlow ships no wheels for the newest Python releases, so it is reported | |
| # only where it is present. It must follow onnx, because it links its own copy | |
| # of protobuf: imported first, onnx's extension binds against that copy instead | |
| # of the one it was built against and the checker segfaults. | |
| try: | |
| import tensorflow as tf | |
| except ImportError: | |
| tf = None | |
| # JAX computes in 32 bits by default, downcasting the int64 and uint64 cases. | |
| jax.config.update("jax_enable_x64", True) | |
| BITSHIFT_OPSET = onnx.defs.get_schema("BitShift").since_version | |
| UNSIGNED = [np.uint8, np.uint16, np.uint32, np.uint64] | |
| SIGNED = [np.int8, np.int16, np.int32, np.int64] | |
| DTYPES = UNSIGNED + SIGNED | |
| INT8_MIN, INT8_MAX = -128, 127 | |
| INT32_MIN, INT32_MAX = -(2**31), 2**31 - 1 | |
| INT64_MIN = -(2**63) | |
| def width(dtype): | |
| """Bit width of an integer type: 8 for int8, 32 for uint32, and so on.""" | |
| return np.dtype(dtype).itemsize * 8 | |
| class Case: | |
| def __init__(self, name, dtype, direction, x, y): | |
| self.direction = direction | |
| self.x = np.array(x).astype(dtype) | |
| self.y = np.array(y).astype(dtype) | |
| # The dtype is on the arrays already, so the caller names only the | |
| # behavior and the table gets the type appended. | |
| self.name = f"{name}_{self.x.dtype.name}" | |
| def numpy_result(self): | |
| fn = np.left_shift if self.direction == "LEFT" else np.right_shift | |
| return fn(self.x, self.y) | |
| def torch_result(self): | |
| fn = ( | |
| torch.bitwise_left_shift | |
| if self.direction == "LEFT" | |
| else torch.bitwise_right_shift | |
| ) | |
| # from_numpy preserves the dtype exactly, and raises for dtypes this | |
| # torch build has no equivalent for, which is reported per case. | |
| return fn(torch.from_numpy(self.x), torch.from_numpy(self.y)).numpy() | |
| def jax_result(self): | |
| fn = ( | |
| jax.numpy.left_shift | |
| if self.direction == "LEFT" | |
| else jax.numpy.right_shift | |
| ) | |
| # jax.numpy.right_shift picks an arithmetic or a logical shift from the | |
| # dtype, which is the rule this operator change adopts. | |
| return np.asarray(fn(self.x, self.y)) | |
| def tensorflow_result(self): | |
| fn = ( | |
| tf.bitwise.left_shift | |
| if self.direction == "LEFT" | |
| else tf.bitwise.right_shift | |
| ) | |
| # TensorFlow clamps the shift count into [0, bit width - 1] instead of | |
| # letting it run off the end, so it parts company with the others | |
| # wherever Y is negative or reaches the width. | |
| return fn(self.x, self.y).numpy() | |
| def mindspore_result(self): | |
| fn = ( | |
| mindspore.ops.bitwise_left_shift | |
| if self.direction == "LEFT" | |
| else mindspore.ops.bitwise_right_shift | |
| ) | |
| return fn(mindspore.Tensor(self.x), mindspore.Tensor(self.y)).asnumpy() | |
| def _model(self): | |
| def value_info(name, shape): | |
| elem_type = onnx.helper.np_dtype_to_tensor_dtype(self.x.dtype) | |
| return onnx.helper.make_tensor_value_info( | |
| name, elem_type, list(shape) | |
| ) | |
| node = onnx.helper.make_node( | |
| "BitShift", ["x", "y"], ["z"], direction=self.direction | |
| ) | |
| graph = onnx.helper.make_graph( | |
| [node], | |
| "bitshift", | |
| [value_info("x", self.x.shape), value_info("y", self.y.shape)], | |
| [value_info("z", np.broadcast_shapes(self.x.shape, self.y.shape))], | |
| ) | |
| model = onnx.helper.make_model( | |
| graph, | |
| opset_imports=[onnx.helper.make_operatorsetid("", BITSHIFT_OPSET)], | |
| ) | |
| # full_check runs shape inference, which is what enforces the type | |
| # constraint; without it a disallowed dtype would slip through. | |
| onnx.checker.check_model(model, full_check=True) | |
| return model | |
| def onnx_result(self): | |
| evaluator = onnx.reference.ReferenceEvaluator(self._model()) | |
| return evaluator.run(None, {"x": self.x, "y": self.y})[0] | |
| def run(self): | |
| implementations = [ | |
| ("numpy", self.numpy_result), | |
| ("torch", self.torch_result), | |
| ("jax", self.jax_result), | |
| ] | |
| if tf is not None: | |
| implementations.append(("tensorflow", self.tensorflow_result)) | |
| if mindspore is not None: | |
| implementations.append(("mindspore", self.mindspore_result)) | |
| implementations.append(("onnx", self.onnx_result)) | |
| results = {} | |
| for label, method in implementations: | |
| try: | |
| results[label] = method() | |
| except Exception as exc: # noqa: BLE001 | |
| # A failure is a result too: torch has no shift for the wider | |
| # unsigned types, and ONNX rejects signed ones before opset 28. | |
| results[label] = exc | |
| return results | |
| def all_cases(): | |
| both = ("RIGHT", "LEFT") | |
| # The two types the signed node tests exercise, and the six they do not. | |
| tested = [np.int8, np.int32] | |
| untested = [np.uint8, np.uint16, np.uint32, np.uint64, np.int16, np.int64] | |
| # Everything down to the negative shift amounts exists as an ONNX node test | |
| # on this branch; everything after that is deliberately not checked in (for | |
| # now). | |
| cases = [ | |
| Case("basic", dt, direction, [16, 4, 1], [1, 2, 3]) | |
| for dt in DTYPES | |
| for direction in both | |
| ] | |
| for name, dt, direction, x, y in [ | |
| ("negative_input", np.int8, "RIGHT", [-8, -1, INT8_MIN], [1, 1, 1]), | |
| ("negative_input", np.int32, "RIGHT", [-8, -1, INT32_MIN], [1, 1, 1]), | |
| ("overflow", np.int8, "LEFT", [64, 1, -64], [1, 7, 1]), | |
| ("overflow", np.int32, "LEFT", [2**30, 1, -(2**30)], [1, 31, 1]), | |
| ("shift_ge_width", np.int8, "RIGHT", [-8, 4, -1], [8, 9, 127]), | |
| ("shift_ge_width", np.int8, "LEFT", [-8, 4, -1], [8, 9, 127]), | |
| ("shift_ge_width", np.int32, "RIGHT", [-8, 4, -1], [32, 33, 100]), | |
| ("shift_ge_width", np.int32, "LEFT", [-8, 4, -1], [32, 33, 100]), | |
| ]: | |
| cases.append(Case(name, dt, direction, x, y)) | |
| # Negative shift amounts. The schema requires Y to be non-negative and | |
| # leaves this undefined, mirroring what numpy.left_shift documents, so any | |
| # result here conforms. | |
| cases += [ | |
| Case( | |
| "negative_shift", | |
| dt, | |
| direction, | |
| [-8, 4, -1], | |
| [-1, -width(dt), -width(dt) * 2], | |
| ) | |
| for dt in tested | |
| for direction in both | |
| ] | |
| # Shift at or past the bit width, on the types the node tests skip. | |
| cases += [ | |
| Case( | |
| "shift_ge_width", | |
| dt, | |
| direction, | |
| [-8, 4, -1] if dt in SIGNED else [8, 4, 1], | |
| [width(dt), width(dt) + 1, width(dt) * 2], | |
| ) | |
| for dt in untested | |
| for direction in both | |
| ] | |
| # Either side of the boundary, where masking the shift count would show up. | |
| cases += [ | |
| Case( | |
| "boundary", | |
| dt, | |
| direction, | |
| [-8, -8, -8], | |
| [width(dt) - 2, width(dt) - 1, width(dt)], | |
| ) | |
| for dt in tested | |
| for direction in both | |
| ] | |
| for name, dt, x, y in [ | |
| ("extremes", np.int8, [INT8_MIN, INT8_MAX, -1], [1, 1, 1]), | |
| ("extremes", np.int32, [INT32_MIN, INT32_MAX, -1], [1, 1, 1]), | |
| ("min_input", np.int64, [INT64_MIN, -1, 1], [1, 1, 1]), | |
| ("shift_by_zero", np.int8, [-8, 4, INT8_MIN], [0, 0, 0]), | |
| ]: | |
| cases += [Case(name, dt, d, x, y) for d in both] | |
| # Broadcasting with a signed dtype, which the node tests do not cover. | |
| cases += [ | |
| Case("bcast_scalar_y", np.int32, "RIGHT", [-64, -8, 8], [2]), | |
| Case("bcast_scalar_x", np.int32, "LEFT", [-1], [0, 1, 2]), | |
| ] | |
| return cases | |
| def fmt(value): | |
| if isinstance(value, Exception): | |
| return f"! {type(value).__name__}: {value}".split("\n")[0] | |
| return "[" + ", ".join(str(v) for v in np.atleast_1d(value)) + "]" | |
| def verdict(results): | |
| values = [v for v in results.values() if not isinstance(v, Exception)] | |
| # Disagreement is checked first: a case where one implementation is missing | |
| # and the rest disagree is still a disagreement, not merely a gap. | |
| if not all(np.array_equal(values[0], v) for v in values[1:]): | |
| return "DIFFER" | |
| if len(values) < len(results): | |
| return "partial" # at least one implementation could not run it | |
| return "same" | |
| def main(): | |
| print(f"onnx {onnx.__version__} (BitShift opset {BITSHIFT_OPSET})") | |
| print(f"numpy {np.__version__}") | |
| print(f"torch {torch.__version__}") | |
| print(f"jax {jax.__version__}") | |
| if tf is not None: | |
| print(f"tensorflow {tf.__version__}") | |
| if mindspore is not None: | |
| print(f"mindspore {mindspore.__version__}") | |
| verdicts = [] | |
| for case in all_cases(): | |
| results = case.run() | |
| verdicts.append(verdict(results)) | |
| print() | |
| print(case.name) | |
| print(f"x: {fmt(case.x)}") | |
| print(f"y: {fmt(case.y)}") | |
| print(f"dir: {case.direction}") | |
| for label, value in results.items(): | |
| print(f"{label}: {fmt(value)}") | |
| print( | |
| f"\n{len(verdicts)} cases: {verdicts.count('DIFFER')} differ in value, " | |
| f"{verdicts.count('partial')} ran in only some implementations." | |
| ) | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| onnx 1.23.0 (BitShift opset 28) | |
| numpy 2.5.1 | |
| torch 2.13.0+cpu | |
| jax 0.11.0 | |
| basic_uint8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt16' | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt16' | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt32' | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt32' | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt64' | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt64' | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| negative_input_int8 | |
| x: [-8, -1, -128] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4, -1, -64] | |
| torch: [-4, -1, -64] | |
| jax: [-4, -1, -64] | |
| onnx: [-4, -1, -64] | |
| negative_input_int32 | |
| x: [-8, -1, -2147483648] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4, -1, -1073741824] | |
| torch: [-4, -1, -1073741824] | |
| jax: [-4, -1, -1073741824] | |
| onnx: [-4, -1, -1073741824] | |
| overflow_int8 | |
| x: [64, 1, -64] | |
| y: [1, 7, 1] | |
| dir: LEFT | |
| numpy: [-128, -128, -128] | |
| torch: [-128, -128, -128] | |
| jax: [-128, -128, -128] | |
| onnx: [-128, -128, -128] | |
| overflow_int32 | |
| x: [1073741824, 1, -1073741824] | |
| y: [1, 31, 1] | |
| dir: LEFT | |
| numpy: [-2147483648, -2147483648, -2147483648] | |
| torch: [-2147483648, -2147483648, -2147483648] | |
| jax: [-2147483648, -2147483648, -2147483648] | |
| onnx: [-2147483648, -2147483648, -2147483648] | |
| shift_ge_width_int8 | |
| x: [-8, 4, -1] | |
| y: [8, 9, 127] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int8 | |
| x: [-8, 4, -1] | |
| y: [8, 9, 127] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int32 | |
| x: [-8, 4, -1] | |
| y: [32, 33, 100] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int32 | |
| x: [-8, 4, -1] | |
| y: [32, 33, 100] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| negative_shift_int8 | |
| x: [-8, 4, -1] | |
| y: [-1, -8, -16] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| negative_shift_int8 | |
| x: [-8, 4, -1] | |
| y: [-1, -8, -16] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| negative_shift_int32 | |
| x: [-8, 4, -1] | |
| y: [-1, -32, -64] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| negative_shift_int32 | |
| x: [-8, 4, -1] | |
| y: [-1, -32, -64] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint8 | |
| x: [8, 4, 1] | |
| y: [8, 9, 16] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint8 | |
| x: [8, 4, 1] | |
| y: [8, 9, 16] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint16 | |
| x: [8, 4, 1] | |
| y: [16, 17, 32] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt16' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint16 | |
| x: [8, 4, 1] | |
| y: [16, 17, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt16' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint32 | |
| x: [8, 4, 1] | |
| y: [32, 33, 64] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt32' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint32 | |
| x: [8, 4, 1] | |
| y: [32, 33, 64] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt32' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint64 | |
| x: [8, 4, 1] | |
| y: [64, 65, 128] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt64' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint64 | |
| x: [8, 4, 1] | |
| y: [64, 65, 128] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt64' | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int16 | |
| x: [-8, 4, -1] | |
| y: [16, 17, 32] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int16 | |
| x: [-8, 4, -1] | |
| y: [16, 17, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int64 | |
| x: [-8, 4, -1] | |
| y: [64, 65, 128] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int64 | |
| x: [-8, 4, -1] | |
| y: [64, 65, 128] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| boundary_int8 | |
| x: [-8, -8, -8] | |
| y: [6, 7, 8] | |
| dir: RIGHT | |
| numpy: [-1, -1, -1] | |
| torch: [-1, -1, -1] | |
| jax: [-1, -1, -1] | |
| onnx: [-1, -1, -1] | |
| boundary_int8 | |
| x: [-8, -8, -8] | |
| y: [6, 7, 8] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| boundary_int32 | |
| x: [-8, -8, -8] | |
| y: [30, 31, 32] | |
| dir: RIGHT | |
| numpy: [-1, -1, -1] | |
| torch: [-1, -1, -1] | |
| jax: [-1, -1, -1] | |
| onnx: [-1, -1, -1] | |
| boundary_int32 | |
| x: [-8, -8, -8] | |
| y: [30, 31, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| extremes_int8 | |
| x: [-128, 127, -1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-64, 63, -1] | |
| torch: [-64, 63, -1] | |
| jax: [-64, 63, -1] | |
| onnx: [-64, 63, -1] | |
| extremes_int8 | |
| x: [-128, 127, -1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, -2] | |
| torch: [0, -2, -2] | |
| jax: [0, -2, -2] | |
| onnx: [0, -2, -2] | |
| extremes_int32 | |
| x: [-2147483648, 2147483647, -1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-1073741824, 1073741823, -1] | |
| torch: [-1073741824, 1073741823, -1] | |
| jax: [-1073741824, 1073741823, -1] | |
| onnx: [-1073741824, 1073741823, -1] | |
| extremes_int32 | |
| x: [-2147483648, 2147483647, -1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, -2] | |
| torch: [0, -2, -2] | |
| jax: [0, -2, -2] | |
| onnx: [0, -2, -2] | |
| min_input_int64 | |
| x: [-9223372036854775808, -1, 1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4611686018427387904, -1, 0] | |
| torch: [-4611686018427387904, -1, 0] | |
| jax: [-4611686018427387904, -1, 0] | |
| onnx: [-4611686018427387904, -1, 0] | |
| min_input_int64 | |
| x: [-9223372036854775808, -1, 1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, 2] | |
| torch: [0, -2, 2] | |
| jax: [0, -2, 2] | |
| onnx: [0, -2, 2] | |
| shift_by_zero_int8 | |
| x: [-8, 4, -128] | |
| y: [0, 0, 0] | |
| dir: RIGHT | |
| numpy: [-8, 4, -128] | |
| torch: [-8, 4, -128] | |
| jax: [-8, 4, -128] | |
| onnx: [-8, 4, -128] | |
| shift_by_zero_int8 | |
| x: [-8, 4, -128] | |
| y: [0, 0, 0] | |
| dir: LEFT | |
| numpy: [-8, 4, -128] | |
| torch: [-8, 4, -128] | |
| jax: [-8, 4, -128] | |
| onnx: [-8, 4, -128] | |
| bcast_scalar_y_int32 | |
| x: [-64, -8, 8] | |
| y: [2] | |
| dir: RIGHT | |
| numpy: [-16, -2, 2] | |
| torch: [-16, -2, 2] | |
| jax: [-16, -2, 2] | |
| onnx: [-16, -2, 2] | |
| bcast_scalar_x_int32 | |
| x: [-1] | |
| y: [0, 1, 2] | |
| dir: LEFT | |
| numpy: [-1, -2, -4] | |
| torch: [-1, -2, -4] | |
| jax: [-1, -2, -4] | |
| onnx: [-1, -2, -4] | |
| 54 cases: 0 differ in value, 12 ran in only some implementations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| onnx 1.23.0 (BitShift opset 28) | |
| numpy 1.26.4 | |
| torch 2.13.0+cpu | |
| jax 0.7.1 | |
| tensorflow 2.21.0 | |
| mindspore 2.10.0 | |
| basic_uint8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt16' | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt16' | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt32' | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt32' | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_uint64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt64' | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_uint64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt64' | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int8 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int16 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int32 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| basic_int64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: RIGHT | |
| numpy: [8, 1, 0] | |
| torch: [8, 1, 0] | |
| jax: [8, 1, 0] | |
| tensorflow: [8, 1, 0] | |
| mindspore: [8, 1, 0] | |
| onnx: [8, 1, 0] | |
| basic_int64 | |
| x: [16, 4, 1] | |
| y: [1, 2, 3] | |
| dir: LEFT | |
| numpy: [32, 16, 8] | |
| torch: [32, 16, 8] | |
| jax: [32, 16, 8] | |
| tensorflow: [32, 16, 8] | |
| mindspore: [32, 16, 8] | |
| onnx: [32, 16, 8] | |
| negative_input_int8 | |
| x: [-8, -1, -128] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4, -1, -64] | |
| torch: [-4, -1, -64] | |
| jax: [-4, -1, -64] | |
| tensorflow: [-4, -1, -64] | |
| mindspore: [-4, -1, -64] | |
| onnx: [-4, -1, -64] | |
| negative_input_int32 | |
| x: [-8, -1, -2147483648] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4, -1, -1073741824] | |
| torch: [-4, -1, -1073741824] | |
| jax: [-4, -1, -1073741824] | |
| tensorflow: [-4, -1, -1073741824] | |
| mindspore: [-4, -1, -1073741824] | |
| onnx: [-4, -1, -1073741824] | |
| overflow_int8 | |
| x: [64, 1, -64] | |
| y: [1, 7, 1] | |
| dir: LEFT | |
| numpy: [-128, -128, -128] | |
| torch: [-128, -128, -128] | |
| jax: [-128, -128, -128] | |
| tensorflow: [-128, -128, -128] | |
| mindspore: [-128, -128, -128] | |
| onnx: [-128, -128, -128] | |
| overflow_int32 | |
| x: [1073741824, 1, -1073741824] | |
| y: [1, 31, 1] | |
| dir: LEFT | |
| numpy: [-2147483648, -2147483648, -2147483648] | |
| torch: [-2147483648, -2147483648, -2147483648] | |
| jax: [-2147483648, -2147483648, -2147483648] | |
| tensorflow: [-2147483648, -2147483648, -2147483648] | |
| mindspore: [-2147483648, -2147483648, -2147483648] | |
| onnx: [-2147483648, -2147483648, -2147483648] | |
| shift_ge_width_int8 | |
| x: [-8, 4, -1] | |
| y: [8, 9, 127] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-1, 0, -1] | |
| mindspore: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int8 | |
| x: [-8, 4, -1] | |
| y: [8, 9, 127] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, -128] | |
| mindspore: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int32 | |
| x: [-8, 4, -1] | |
| y: [32, 33, 100] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-1, 0, -1] | |
| mindspore: [-8, 2, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int32 | |
| x: [-8, 4, -1] | |
| y: [32, 33, 100] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, -2147483648] | |
| mindspore: [-8, 8, -16] | |
| onnx: [0, 0, 0] | |
| negative_shift_int8 | |
| x: [-8, 4, -1] | |
| y: [-1, -8, -16] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-8, 4, -1] | |
| mindspore: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| negative_shift_int8 | |
| x: [-8, 4, -1] | |
| y: [-1, -8, -16] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [-8, 4, -1] | |
| mindspore: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| negative_shift_int32 | |
| x: [-8, 4, -1] | |
| y: [-1, -32, -64] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-8, 4, -1] | |
| mindspore: [-1, 4, -1] | |
| onnx: [-1, 0, -1] | |
| negative_shift_int32 | |
| x: [-8, 4, -1] | |
| y: [-1, -32, -64] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [-8, 4, -1] | |
| mindspore: [0, 4, -1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint8 | |
| x: [8, 4, 1] | |
| y: [8, 9, 16] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint8 | |
| x: [8, 4, 1] | |
| y: [8, 9, 16] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 128] | |
| mindspore: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint16 | |
| x: [8, 4, 1] | |
| y: [16, 17, 32] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt16' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [0, 0, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint16 | |
| x: [8, 4, 1] | |
| y: [16, 17, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt16' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 32768] | |
| mindspore: [0, 0, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint32 | |
| x: [8, 4, 1] | |
| y: [32, 33, 64] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt32' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [8, 2, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint32 | |
| x: [8, 4, 1] | |
| y: [32, 33, 64] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt32' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 2147483648] | |
| mindspore: [8, 8, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint64 | |
| x: [8, 4, 1] | |
| y: [64, 65, 128] | |
| dir: RIGHT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "rshift_cpu" not implemented for 'UInt64' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [8, 2, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_uint64 | |
| x: [8, 4, 1] | |
| y: [64, 65, 128] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: ! NotImplementedError: "lshift_cpu" not implemented for 'UInt64' | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 9223372036854775808] | |
| mindspore: [8, 8, 1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int16 | |
| x: [-8, 4, -1] | |
| y: [16, 17, 32] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-1, 0, -1] | |
| mindspore: [-1, 0, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int16 | |
| x: [-8, 4, -1] | |
| y: [16, 17, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, -32768] | |
| mindspore: [0, 0, -1] | |
| onnx: [0, 0, 0] | |
| shift_ge_width_int64 | |
| x: [-8, 4, -1] | |
| y: [64, 65, 128] | |
| dir: RIGHT | |
| numpy: [-1, 0, -1] | |
| torch: [-1, 0, -1] | |
| jax: [-1, 0, -1] | |
| tensorflow: [-1, 0, -1] | |
| mindspore: [-8, 2, -1] | |
| onnx: [-1, 0, -1] | |
| shift_ge_width_int64 | |
| x: [-8, 4, -1] | |
| y: [64, 65, 128] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, -9223372036854775808] | |
| mindspore: [-8, 8, -1] | |
| onnx: [0, 0, 0] | |
| boundary_int8 | |
| x: [-8, -8, -8] | |
| y: [6, 7, 8] | |
| dir: RIGHT | |
| numpy: [-1, -1, -1] | |
| torch: [-1, -1, -1] | |
| jax: [-1, -1, -1] | |
| tensorflow: [-1, -1, -1] | |
| mindspore: [-1, -1, -1] | |
| onnx: [-1, -1, -1] | |
| boundary_int8 | |
| x: [-8, -8, -8] | |
| y: [6, 7, 8] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [0, 0, 0] | |
| onnx: [0, 0, 0] | |
| boundary_int32 | |
| x: [-8, -8, -8] | |
| y: [30, 31, 32] | |
| dir: RIGHT | |
| numpy: [-1, -1, -1] | |
| torch: [-1, -1, -1] | |
| jax: [-1, -1, -1] | |
| tensorflow: [-1, -1, -1] | |
| mindspore: [-1, -1, -8] | |
| onnx: [-1, -1, -1] | |
| boundary_int32 | |
| x: [-8, -8, -8] | |
| y: [30, 31, 32] | |
| dir: LEFT | |
| numpy: [0, 0, 0] | |
| torch: [0, 0, 0] | |
| jax: [0, 0, 0] | |
| tensorflow: [0, 0, 0] | |
| mindspore: [0, 0, -8] | |
| onnx: [0, 0, 0] | |
| extremes_int8 | |
| x: [-128, 127, -1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-64, 63, -1] | |
| torch: [-64, 63, -1] | |
| jax: [-64, 63, -1] | |
| tensorflow: [-64, 63, -1] | |
| mindspore: [-64, 63, -1] | |
| onnx: [-64, 63, -1] | |
| extremes_int8 | |
| x: [-128, 127, -1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, -2] | |
| torch: [0, -2, -2] | |
| jax: [0, -2, -2] | |
| tensorflow: [0, -2, -2] | |
| mindspore: [0, -2, -2] | |
| onnx: [0, -2, -2] | |
| extremes_int32 | |
| x: [-2147483648, 2147483647, -1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-1073741824, 1073741823, -1] | |
| torch: [-1073741824, 1073741823, -1] | |
| jax: [-1073741824, 1073741823, -1] | |
| tensorflow: [-1073741824, 1073741823, -1] | |
| mindspore: [-1073741824, 1073741823, -1] | |
| onnx: [-1073741824, 1073741823, -1] | |
| extremes_int32 | |
| x: [-2147483648, 2147483647, -1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, -2] | |
| torch: [0, -2, -2] | |
| jax: [0, -2, -2] | |
| tensorflow: [0, -2, -2] | |
| mindspore: [0, -2, -2] | |
| onnx: [0, -2, -2] | |
| min_input_int64 | |
| x: [-9223372036854775808, -1, 1] | |
| y: [1, 1, 1] | |
| dir: RIGHT | |
| numpy: [-4611686018427387904, -1, 0] | |
| torch: [-4611686018427387904, -1, 0] | |
| jax: [-4611686018427387904, -1, 0] | |
| tensorflow: [-4611686018427387904, -1, 0] | |
| mindspore: [-4611686018427387904, -1, 0] | |
| onnx: [-4611686018427387904, -1, 0] | |
| min_input_int64 | |
| x: [-9223372036854775808, -1, 1] | |
| y: [1, 1, 1] | |
| dir: LEFT | |
| numpy: [0, -2, 2] | |
| torch: [0, -2, 2] | |
| jax: [0, -2, 2] | |
| tensorflow: [0, -2, 2] | |
| mindspore: [0, -2, 2] | |
| onnx: [0, -2, 2] | |
| shift_by_zero_int8 | |
| x: [-8, 4, -128] | |
| y: [0, 0, 0] | |
| dir: RIGHT | |
| numpy: [-8, 4, -128] | |
| torch: [-8, 4, -128] | |
| jax: [-8, 4, -128] | |
| tensorflow: [-8, 4, -128] | |
| mindspore: [-8, 4, -128] | |
| onnx: [-8, 4, -128] | |
| shift_by_zero_int8 | |
| x: [-8, 4, -128] | |
| y: [0, 0, 0] | |
| dir: LEFT | |
| numpy: [-8, 4, -128] | |
| torch: [-8, 4, -128] | |
| jax: [-8, 4, -128] | |
| tensorflow: [-8, 4, -128] | |
| mindspore: [-8, 4, -128] | |
| onnx: [-8, 4, -128] | |
| bcast_scalar_y_int32 | |
| x: [-64, -8, 8] | |
| y: [2] | |
| dir: RIGHT | |
| numpy: [-16, -2, 2] | |
| torch: [-16, -2, 2] | |
| jax: [-16, -2, 2] | |
| tensorflow: [-16, -2, 2] | |
| mindspore: [-16, -2, 2] | |
| onnx: [-16, -2, 2] | |
| bcast_scalar_x_int32 | |
| x: [-1] | |
| y: [0, 1, 2] | |
| dir: LEFT | |
| numpy: [-1, -2, -4] | |
| torch: [-1, -2, -4] | |
| jax: [-1, -2, -4] | |
| tensorflow: [-1, -2, -4] | |
| mindspore: [-1, -2, -4] | |
| onnx: [-1, -2, -4] | |
| 54 cases: 19 differ in value, 6 ran in only some implementations. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment