MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/contrib/mpi_collectives/__init__.py:246–275  ·  view source on GitHub ↗

Creates a new TensorFlow MPI session. Unlike a normal `tf.Session`, an MPI Session may only use a single GPU, which must be specified in advance before the session is initialized. In addition, it only uses a single graph evaluation thread, and initializes MPI immediately upon starti

(self, target='', graph=None, config=None)

Source from the content-addressed store, hash-verified

244 """
245
246 def __init__(self, target='', graph=None, config=None):
247 """Creates a new TensorFlow MPI session.
248
249 Unlike a normal `tf.Session`, an MPI Session may only use a single GPU,
250 which must be specified in advance before the session is initialized.
251 In addition, it only uses a single graph evaluation thread, and
252 initializes MPI immediately upon starting.
253
254 If no `graph` argument is specified when constructing the session,
255 the default graph will be launched in the session. If you are
256 using more than one graph (created with `tf.Graph()` in the same
257 process, you will have to use different sessions for each graph,
258 but each graph can be used in multiple sessions. In this case, it
259 is often clearer to pass the graph to be launched explicitly to
260 the session constructor.
261
262 Args:
263 target: (Optional.) The execution engine to connect to.
264 graph: (Optional.) The `Graph` to be launched (described above).
265 config: (Optional.) A `ConfigProto` protocol buffer with configuration
266 options for the session.
267 """
268 super(Session, self).__init__(target, graph, config=config)
269
270 # Initialize MPI on the relevant device.
271 # TODO: Move this to library load and eliminate mpi.Session()
272 if graph is None:
273 graph = tf.get_default_graph()
274 with graph.as_default():
275 self.run(init())

Callers 1

__init__Method · 0.45

Calls 3

runMethod · 0.95
initFunction · 0.90
as_defaultMethod · 0.45

Tested by

no test coverage detected