Skip to content

Question about multiple dimension string tensor using CXX api #1627

Closed

Description

@qw2208

I'm creating a string tensor of two dimensions:
WeChat Screenshot_20190815152341
Since my onnx model requires one input of dimension [1,2] type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING.

For one string tensor input, I could validate the results as this link suggests. I'm wondering how I could get the created tensor and see the string value of each dimension? In other words, how could I use the api GetStringTensorContent for multiple dimension?

Activity

  1. RyanUnderhill commented on Aug 15, 2019

    @RyanUnderhill
    Contributor

    I'm not sure what you mean by each dimension. Calling GetStringTensorContent will return all elements of a string tensor. So for example, one with shape { 2, 3, 4 } will return 24 elements (with the same order as other basic type tensors).

    Or are you trying to get a subset of the tensor?

  2. qw2208 commented on Aug 16, 2019

    @qw2208
    Author

    Yes. You just answered my question. I'd like to make sure with the tensor I created:
    WeChat Screenshot_20190815152341
    I can get the tensor by running the codes below?
    WeChat Screenshot_20190816104009
    The string tensor will be returned in result?

  3. RyanUnderhill commented on Aug 19, 2019

    @RyanUnderhill
    Contributor

    Yes, in this case results will be a single concatenated string in result and the offsets vector holds the starts of each string (the length is just the start of one until the start of the next one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions