Class Tensor
java.lang.Object
smile.onnx.genai.Tensor
- All Implemented Interfaces:
AutoCloseable
Thin GenAI tensor wrapper for
Generator.setModelInput(String, Tensor) / multimodal inputs.
Element-type ordinals match OgaElementType / ONNX tensor element types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumElement types matchingOgaElementType. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static Tensorof(ByteBuffer data, long[] shape, Tensor.ElementType elementType) Creates a tensor from a direct native-orderByteBuffer.long[]shape()Returns a copy of the shape.type()Returns the element type.
-
Method Details
-
of
Creates a tensor from a direct native-orderByteBuffer.- Parameters:
data- direct buffer with native byte order; kept reachable.shape- tensor shape.elementType- element type.- Returns:
- tensor owned by the caller.
-
type
-
shape
public long[] shape()Returns a copy of the shape.- Returns:
- shape.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-