LostTech.TensorFlow : API Documentation

Type Session

Namespace tensorflow

Parent BaseSession

Interfaces ISession, IContextManager<T>

A class for running TensorFlow operations.

A `Session` object encapsulates the environment in which `Operation` objects are executed, and `Tensor` objects are evaluated. For example: A session may own resources, such as tf.Variable, tf.queue.QueueBase, and `tf.compat.v1.ReaderBase`. It is important to release these resources when they are no longer required. To do this, either invoke the tf.Session.close method on the session, or use the session as a context manager. The following two examples are equivalent: The [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) protocol buffer exposes various configuration options for a session. For example, to create a session that uses soft constraints for device placement, and log the resulting placement decisions, create a session as follows:
Show Example
# Build a graph.
            a = tf.constant(5.0)
            b = tf.constant(6.0)
            c = a * b 

# Launch the graph in a session. sess = tf.compat.v1.Session()

# Evaluate the tensor `c`. print(sess.run(c))

Methods

Properties

Public instance methods

void __del__()

Do not rely on the destructor to undo your stubs.

You cannot guarantee exactly when the destructor will get called without relying on implementation details of a Python VM that may change.

object __del___dyn()

Do not rely on the destructor to undo your stubs.

You cannot guarantee exactly when the destructor will get called without relying on implementation details of a Python VM that may change.

IEnumerator<object> as_default()

Returns a context manager that makes this `Graph` the default graph.

This method should be used if you want to create multiple graphs in the same process. For convenience, a global default graph is provided, and all ops will be added to this graph if you do not create a new graph explicitly.

Use this method with the `with` keyword to specify that ops created within the scope of a block should be added to this graph. In this case, once the scope of the `with` is exited, the previous default graph is set again as default. There is a stack, so it's ok to have multiple nested levels of `as_default` calls.

The default graph is a property of the current thread. If you create a new thread, and wish to use the default graph in that thread, you must explicitly add a `with g.as_default():` in that thread's function.

The following code examples are equivalent: If eager execution is enabled ops created under this context manager will be added to the graph instead of executed eagerly.
Returns
IEnumerator<object>
A context manager for using this graph as the default graph.
Show Example
# 1. Using Graph.as_default():
            g = tf.Graph()
            with g.as_default():
              c = tf.constant(5.0)
              assert c.graph is g 

# 2. Constructing and making default: with tf.Graph().as_default() as g: c = tf.constant(5.0) assert c.graph is g

object as_default_dyn()

Returns a context manager that makes this `Graph` the default graph.

This method should be used if you want to create multiple graphs in the same process. For convenience, a global default graph is provided, and all ops will be added to this graph if you do not create a new graph explicitly.

Use this method with the `with` keyword to specify that ops created within the scope of a block should be added to this graph. In this case, once the scope of the `with` is exited, the previous default graph is set again as default. There is a stack, so it's ok to have multiple nested levels of `as_default` calls.

The default graph is a property of the current thread. If you create a new thread, and wish to use the default graph in that thread, you must explicitly add a `with g.as_default():` in that thread's function.

The following code examples are equivalent: If eager execution is enabled ops created under this context manager will be added to the graph instead of executed eagerly.
Returns
object
A context manager for using this graph as the default graph.
Show Example
# 1. Using Graph.as_default():
            g = tf.Graph()
            with g.as_default():
              c = tf.constant(5.0)
              assert c.graph is g 

# 2. Constructing and making default: with tf.Graph().as_default() as g: c = tf.constant(5.0) assert c.graph is g

object make_callable(object fetches, object feed_list, bool accept_options)

object make_callable(PythonClassContainer fetches, object feed_list, bool accept_options)

object make_callable(IGraphNodeBase fetches, object feed_list, bool accept_options)

object make_callable(Operation fetches, object feed_list, bool accept_options)

object make_callable(IEnumerable<object> fetches, object feed_list, bool accept_options)

object make_callable_dyn(object fetches, object feed_list, ImplicitContainer<T> accept_options)

object partial_run(object handle, IGraphNodeBase fetches, IDictionary<object, object> feed_dict)

object partial_run(object handle, IEnumerable<object> fetches, IDictionary<object, object> feed_dict)

object partial_run_dyn(object handle, object fetches, object feed_dict)

object partial_run_setup(IEnumerable<object> fetches, IEnumerable<object> feeds)

object partial_run_setup_dyn(object fetches, object feeds)

object run(PythonFunctionContainer fetches, IDictionary<object, object> feed_dict, string options, string run_metadata)

object run(IDictionary<string, IGraphNodeBase> fetches, IDictionary<object, object> feed_dict, string options, string run_metadata)

object run(IEnumerable<IGraphNodeBase> fetches, IDictionary<object, object> feed_dict, string options, string run_metadata)

object run(IEnumerable<IGraphNodeBase> fetches, BaseSession feed_dict, string options, string run_metadata)

object run(IEnumerable<IGraphNodeBase> fetches, string feed_dict, string options, string run_metadata)

object run(IDictionary<string, object> fetches, string feed_dict, string options, string run_metadata)

object run(PythonFunctionContainer fetches, BaseSession feed_dict, string options, string run_metadata)

object run(object fetches, IDictionary<object, object> feed_dict, string options, string run_metadata)

object run(PythonFunctionContainer fetches, string feed_dict, string options, string run_metadata)

object run(IDictionary<string, IGraphNodeBase> fetches, BaseSession feed_dict, string options, string run_metadata)

object run(object fetches, string feed_dict, string options, string run_metadata)

object run(object fetches, BaseSession feed_dict, string options, string run_metadata)

object run_dyn(object fetches, object feed_dict, object options, object run_metadata)

Public static methods

void reset(string target, IEnumerable<string> containers, object config)

Resets resource containers on `target`, and close all connected sessions.

A resource container is distributed across all workers in the same cluster as `target`. When a resource container on `target` is reset, resources associated with that container will be cleared. In particular, all Variables in the container will become undefined: they lose their values and shapes.

NOTE: (i) reset() is currently only implemented for distributed sessions. (ii) Any sessions on the master named by `target` will be closed.

If no resource containers are provided, all containers are reset.
Parameters
string target
The execution engine to connect to.
IEnumerable<string> containers
A list of resource container name strings, or `None` if all of all the containers are to be reset.
object config
(Optional.) Protocol buffer with configuration options.

void reset(Byte[] target, IEnumerable<string> containers, object config)

Resets resource containers on `target`, and close all connected sessions.

A resource container is distributed across all workers in the same cluster as `target`. When a resource container on `target` is reset, resources associated with that container will be cleared. In particular, all Variables in the container will become undefined: they lose their values and shapes.

NOTE: (i) reset() is currently only implemented for distributed sessions. (ii) Any sessions on the master named by `target` will be closed.

If no resource containers are provided, all containers are reset.
Parameters
Byte[] target
The execution engine to connect to.
IEnumerable<string> containers
A list of resource container name strings, or `None` if all of all the containers are to be reset.
object config
(Optional.) Protocol buffer with configuration options.

object reset_dyn(object target, object containers, object config)

Resets resource containers on `target`, and close all connected sessions.

A resource container is distributed across all workers in the same cluster as `target`. When a resource container on `target` is reset, resources associated with that container will be cleared. In particular, all Variables in the container will become undefined: they lose their values and shapes.

NOTE: (i) reset() is currently only implemented for distributed sessions. (ii) Any sessions on the master named by `target` will be closed.

If no resource containers are provided, all containers are reset.
Parameters
object target
The execution engine to connect to.
object containers
A list of resource container name strings, or `None` if all of all the containers are to be reset.
object config
(Optional.) Protocol buffer with configuration options.

Public properties

object graph get;

object graph_def get;

object graph_def_dyn get;

object graph_dyn get;

object PythonObject get;

Byte[] sess_str get;

object sess_str_dyn get;