# OnnxSequence (onnxruntime 1.15.0 API)

Package ai.onnxruntime

## Class OnnxSequence

- java.lang.Object
- - ai.onnxruntime.OnnxSequence

All Implemented Interfaces:
  `OnnxValue`, `java.lang.AutoCloseable`

    public class OnnxSequence
    extends java.lang.Object
    implements OnnxValue

A sequence of `OnnxValue`s all of the same type.

Supports the types mentioned in "onnxruntime_c_api.h", currently

- OnnxTensor<String>
- OnnxTensor<Long>
- OnnxTensor<Float>
- OnnxTensor<Double>
- OnnxMap<String,Float>
- OnnxMap<Long,Float>

### Nested Class Summary

### Nested classes/interfaces inherited from interface ai.onnxruntime.OnnxValue

`OnnxValue.OnnxValueType`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes this sequence, releasing the native memory backing it and it's elements.
`SequenceInfo` `getInfo()` Gets the type info object associated with this OnnxValue.
`OnnxValue.OnnxValueType` `getType()` Gets the type of this OnnxValue.
`java.util.List<? extends OnnxValue>` `getValue()` Extracts a Java list of the `OnnxValue`s which can then be further unwrapped.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Method Detail

#### getType

    public OnnxValue.OnnxValueType getType()

Description copied from interface: `OnnxValue`
Gets the type of this OnnxValue.

Specified by:
  `getType` in interface `OnnxValue`
Returns:
  The value type.

#### getValue

    public java.util.List<? extends OnnxValue> getValue()
                                                 throws OrtException

Extracts a Java list of the `OnnxValue`s which can then be further unwrapped.

Returns either a `List` of either `OnnxTensor` or `OnnxMap`.

Note unlike the other `OnnxValue.getValue()` methods, this does not copy the values themselves into the Java heap, it merely exposes them as `OnnxValue` instances, allowing users to use the faster copy methods available for `OnnxTensor`. This also means that those values need to be closed separately from this instance, and are not closed by `close()` on this object.

Specified by:
  `getValue` in interface `OnnxValue`
Returns:
  A Java list containing the values.
Throws:
  `OrtException` - If the runtime failed to read an element.

#### getInfo

    public SequenceInfo getInfo()

Description copied from interface: `OnnxValue`
Gets the type info object associated with this OnnxValue.

Specified by:
  `getInfo` in interface `OnnxValue`
Returns:
  The type information.

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### close

    public void close()

Closes this sequence, releasing the native memory backing it and it's elements.

Specified by:
  `close` in interface `java.lang.AutoCloseable`
Specified by:
  `close` in interface `OnnxValue`