Session

Session is an extension of tf.Session that lets the graph run in a secure manner.

You get and use a session the same way that you’re used to with Tensorflow:

import tf_encrypted as tfe

with tfe.Session() as sess:
  # sess.run like normal

TODO – More coming soon.

class tf_encrypted.session.Session(graph=None, config=None)[source]

Wrap a Tensorflow Session.

See tf.Session

Parameters:
  • graph (Optional[tf.Graph]) – A tf.Graph. Used in the same as in tensorflow. This is the graph to be launched. If nothing is specified then the default session graph will be used.
  • config (Optional[Config]) – A Local or Remote config to be used to execute the graph.
run(fetches: Any, feed_dict: Dict[tensorflow.python.framework.ops.Tensor, numpy.ndarray] = {}, tag: Optional[str] = None, write_trace: bool = False)[source]

See :meth:tf.Session.run

This method functions just as the one from tensorflow.

Parameters:
  • fetches (Any) – A single graph element, a list of graph elements, or a dictionary whose values are graph elements or lists of graph elements.
  • feed_dict (Dict[str,np.ndarray]) – A dictionary that maps graph elements to values.
  • tag (Optional[str]) – A namespace to run the session under.
  • write_Trace (bool) – If true, the session logs will be dumped to be used in tensorboard.
Return type:

Any

Returns:

Either a single value if fetches is a single graph element, or a list of values if fetches is a list, or a dictionary with the same keys as fetches if that is a dictionary (described above). Order in which fetches operations are evaluated inside the call is undefined.