public class SessionFunction extends Object implements TensorFunction
Does no resource management, the session and all returned tensors are the caller's responsibility.
Does not initialize the session, since it may be shared.
Constructor and Description |
---|
SessionFunction(Signature signature,
Session session) |
Modifier and Type | Method and Description |
---|---|
Map<String,Tensor> |
call(Map<String,Tensor> arguments)
Invokes a function using the default eager session.
|
static SessionFunction |
create(Signature signature,
Session session) |
void |
save(String exportDir)
Save this function using
SavedModelBundle . |
Session |
session() |
Signature |
signature()
Returns the signature of this function
|
SessionFunction |
withNewSession(Session session)
Get a new function with the same signature, but backed by a new session.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
call, validateDescription
public static SessionFunction create(Signature signature, Session session)
public void save(String exportDir) throws IOException
SavedModelBundle
.
This is identical to calling SavedModelBundle.exporter(exportDir).withFunction(this).export()
.
exportDir
- the directory path containing a saved model.IOException
- if saved model or variable state cannot be written on diskpublic Signature signature()
TensorFunction
signature
in interface TensorFunction
public Session session()
public SessionFunction withNewSession(Session session)
session
- the new backing session.public Map<String,Tensor> call(Map<String,Tensor> arguments)
TensorFunction
Caller is responsible for closing all Tensors.
call
in interface TensorFunction
arguments
- list of tensors to pass in input to the function, mapped by their signature
nameCopyright © 2015–2022. All rights reserved.