Package org.tribuo.interop.tensorflow
Class TensorMap
java.lang.Object
org.tribuo.interop.tensorflow.TensorMap
- All Implemented Interfaces:
AutoCloseable
A map of names and tensors to feed into a session.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
org.tensorflow.Session.Runner
feedInto
(org.tensorflow.Session.Runner runner) Feeds the tensors in this FeedDict into the runner.getMap()
Returns the underlying immutable map.Optional<org.tensorflow.Tensor>
Returns the specified tensor if present.toString()
-
Constructor Details
-
TensorMap
Creates a TensorMap containing the supplied mapping.- Parameters:
inputName
- The input name.value
- The tensor value.
-
TensorMap
Creates a new TensorMap wrapping the supplied map.- Parameters:
map
- A map from strings to tensors.
-
-
Method Details
-
getMap
Returns the underlying immutable map.- Returns:
- The map.
-
getTensor
Returns the specified tensor if present.- Parameters:
key
- The key to lookup.- Returns:
- An optional containing the specified tensor if it's in the map, an empty optional otherwise.
-
feedInto
public org.tensorflow.Session.Runner feedInto(org.tensorflow.Session.Runner runner) Feeds the tensors in this FeedDict into the runner.If the session does not have placeholders with the names used in this TensorMap then the
Session.Runner
will throwIllegalArgumentException
.- Parameters:
runner
- The session runner.- Returns:
- The runner.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
toString
-