(l-onnx-doc-StringConcat)= # StringConcat (l-onnx-op-stringconcat-20)= ## StringConcat - 20 ### Version - **name**: [StringConcat (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#StringConcat) - **domain**: `main` - **since_version**: `20` - **function**: `False` - **support_level**: `SupportType.COMMON` - **shape inference**: `True` This version of the operator has been available **since version 20**. ### Summary StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support) ### Inputs - **X** (heterogeneous) - **T**: Tensor to prepend in concatenation - **Y** (heterogeneous) - **T**: Tensor to append in concatenation ### Outputs - **Z** (heterogeneous) - **T**: Concatenated string tensor ### Type Constraints * **T** in ( `tensor(string)` ): Inputs and outputs must be UTF-8 strings ### Examples #### default ```python import numpy as np import onnx node = onnx.helper.make_node( "StringConcat", inputs=["x", "y"], outputs=["result"], ) x = np.array(["abc", "def"]).astype("object") y = np.array([".com", ".net"]).astype("object") result = np.array(["abc.com", "def.net"]).astype("object") expect(node, inputs=[x, y], outputs=[result], name="test_string_concat") x = np.array(["cat", "dog", "snake"]).astype("object") y = np.array(["s"]).astype("object") result = np.array(["cats", "dogs", "snakes"]).astype("object") expect( node, inputs=[x, y], outputs=[result], name="test_string_concat_broadcasting", ) x = np.array("cat").astype("object") y = np.array("s").astype("object") result = np.array("cats").astype("object") expect( node, inputs=[x, y], outputs=[result], name="test_string_concat_zero_dimensional", ) x = np.array(["abc", ""]).astype("object") y = np.array(["", "abc"]).astype("object") result = np.array(["abc", "abc"]).astype("object") expect( node, inputs=[x, y], outputs=[result], name="test_string_concat_empty_string", ) x = np.array(["的", "中"]).astype("object") y = np.array(["的", "中"]).astype("object") result = np.array(["的的", "中中"]).astype("object") expect( node, inputs=[x, y], outputs=[result], name="test_string_concat_utf8", ) ```