Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

EagerSession

public final class EagerSession

An environment for executing TensorFlow operations eagerly.

Eager execution is an imperative programming environment that evaluates operations immediately, without building graphs. Operations return concrete values instead of constructing a computational graph to run later, as with Graphs and Sessions.

This makes it easy to develop with TensorFlow and debug models, as it behaves more like a standard programming library.

Instances of a EagerSession are thread-safe.

WARNING: Resources consumed by an EagerSession object must be explicitly freed by invoking the close() method when it is no longer needed. This could be achieve using the `try-with-resources` technique as the example below:

try (EagerSession s = EagerSession.create()) {
    // execute operations eagerly
 }
 
In addition, EagerSession objects clean up unused resources during the session, working in pair with the JVM garbage collector. See EagerSession.ResourceCleanupStrategy for more details.

Nested Classes

enum EagerSession.DevicePlacementPolicy Controls how to act when we try to run an operation on a given device but some input tensors are not on that device. 
class EagerSession.Options  
enum EagerSession.ResourceCleanupStrategy Controls how TensorFlow resources are cleaned up when they are no longer needed. 

Public Methods

synchronized void
close()
static EagerSession
create()
Returns an EagerSession configured with default options.
OperationBuilder
opBuilder(String type, String name)
Returns a builder to create a new Operation.
static EagerSession.Options
options()
Returns an object that configures and builds a EagerSession with custom options.

Inherited Methods

Public Methods

public synchronized void close ()

public static EagerSession create ()

Returns an EagerSession configured with default options.

public OperationBuilder opBuilder (String type, String name)

Returns a builder to create a new Operation.

Parameters
type of the Operation (i.e., identifies the computation to be performed)
name to refer to the created Operation in this environment scope.
Returns

public static EagerSession.Options options ()

Returns an object that configures and builds a EagerSession with custom options.