Interface OnnxValue

  • All Superinterfaces:
    All Known Implementing Classes:
    OnnxMap, OnnxSequence, OnnxTensor

    public interface OnnxValue
    extends java.lang.AutoCloseable
    Top interface for input and output values from ONNX models. Currently implemented by OnnxTensor, OnnxSequence and OnnxMap. Will be sealed to these types one day.

    Does not support sparse tensors.

    • Method Detail

      • getValue

        java.lang.Object getValue()
                           throws OrtException
        Returns the value as a Java object copying it out of the native heap. This operation can be quite slow for high dimensional tensors, where you should prefer OnnxTensor.getByteBuffer() etc.

        Overridden by the subclasses with a more specific type if available.

        The value.
        OrtException - If an error occurred reading the value.
      • getInfo

        ValueInfo getInfo()
        Gets the type info object associated with this OnnxValue.
        The type information.
      • close

        void close()
        Closes the OnnxValue, freeing it's native memory.
        Specified by:
        close in interface java.lang.AutoCloseable
      • close

        static void close​(java.lang.Iterable<? extends OnnxValue> itr)
        Calls close on each element of the iterable.
        itr - An iterable of closeable OnnxValues.
      • close

        static void close​(java.util.Map<java.lang.String,​? extends OnnxValue> map)
        Calls close on each OnnxValue in the map.
        map - A map of OnnxValues.