StringConcat#

  • Domain: ai.onnx

  • Since version: 20

StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support)

Inputs

  • X (T): Tensor to prepend in concatenation

  • Y (T): Tensor to append in concatenation

Outputs

  • Z (T): Concatenated string tensor

Type Constraints

  • T: Inputs and outputs must be UTF-8 strings Allowed types: tensor(string).

Examples#

test_cc_string_concat

Inputs:
  x: shape=(3,), dtype=object
    ['abc', '', 'hello ']
  y: shape=(3,), dtype=object
    ['def', 'xyz', 'world']

Outputs:
  z: shape=(3,), dtype=object
    ['abcdef', 'xyz', 'hello world']

test_cc_string_concat_bcast

Inputs:
  x: shape=(2, 2), dtype=object
    [['a', 'b'],
     ['c', 'd']]
  y: shape=(), dtype=object
    '!'

Outputs:
  z: shape=(2, 2), dtype=object
    [['a!', 'b!'],
     ['c!', 'd!']]

test_cc_string_concat_chained_3in_1out

Inputs:
  x: shape=(3,), dtype=object
    ['abc', 'def', 'ghi']
  y: shape=(3,), dtype=object
    ['-', '/', '.']
  input_2: shape=(3,), dtype=object
    ['123', '456', '789']

Outputs:
  tmp: shape=(3,), dtype=object
    ['abc-123', 'def/456', 'ghi.789']

test_cc_string_concat_utf8

Inputs:
  x: shape=(2,), dtype=object
    ['的', '中']
  y: shape=(2,), dtype=object
    ['的', '中']

Outputs:
  z: shape=(2,), dtype=object
    ['的的', '中中']

test_cc_string_concat_zero_dimensional

Inputs:
  x: shape=(), dtype=object
    'cat'
  y: shape=(), dtype=object
    's'

Outputs:
  z: shape=(), dtype=object
    'cats'