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

Class _TensorTracker

tensorflow/python/client/timeline.py:301–379  ·  view source on GitHub ↗

An internal class to track the lifetime of a Tensor.

Source from the content-addressed store, hash-verified

299
300
301class _TensorTracker(object):
302 """An internal class to track the lifetime of a Tensor."""
303
304 def __init__(self, name, object_id, timestamp, pid, allocator, num_bytes):
305 """Creates an object to track tensor references.
306
307 This class is not thread safe and is intended only for internal use by
308 the 'Timeline' class in this file.
309
310 Args:
311 name: The name of the Tensor as a string.
312 object_id: Chrome Trace object identifier assigned for this Tensor.
313 timestamp: The creation timestamp of this event as a long integer.
314 pid: Process identifier of the associated device, as an integer.
315 allocator: Name of the allocator used to create the Tensor.
316 num_bytes: Number of bytes allocated (long integer).
317
318 Returns:
319 A 'TensorTracker' object.
320 """
321 self._name = name
322 self._pid = pid
323 self._object_id = object_id
324 self._create_time = timestamp
325 self._allocator = allocator
326 self._num_bytes = num_bytes
327 self._ref_times = []
328 self._unref_times = []
329
330 @property
331 def name(self):
332 """Name of this tensor."""
333 return self._name
334
335 @property
336 def pid(self):
337 """ID of the process which created this tensor (an integer)."""
338 return self._pid
339
340 @property
341 def create_time(self):
342 """Timestamp when this tensor was created (long integer)."""
343 return self._create_time
344
345 @property
346 def object_id(self):
347 """Returns the object identifier of this tensor (integer)."""
348 return self._object_id
349
350 @property
351 def num_bytes(self):
352 """Size of this tensor in bytes (long integer)."""
353 return self._num_bytes
354
355 @property
356 def allocator(self):
357 """Name of the allocator used to create this tensor (string)."""
358 return self._allocator

Callers 1

_produce_tensorMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected