Class NamedTensors
java.lang.Object
smile.onnx.genai.NamedTensors
- All Implemented Interfaces:
AutoCloseable
Named collection of tensors matching model input names.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longcount()Returns the number of named tensors.static NamedTensorscreate()Creates an empty named-tensor container.Deletes a named tensor entry.Returns a copy of the named tensor.String[]names()Returns the tensor names.Sets a named tensor (takes a reference; the tensor must outlive use).
-
Method Details
-
create
Creates an empty named-tensor container.- Returns:
- a new container owned by the caller.
-
set
Sets a named tensor (takes a reference; the tensor must outlive use).- Parameters:
name- input name.tensor- tensor value.- Returns:
thisfor chaining.
-
get
-
delete
Deletes a named tensor entry.- Parameters:
name- input name.- Returns:
thisfor chaining.
-
count
public long count()Returns the number of named tensors.- Returns:
- count.
-
names
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-