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

Method _set_device_from_string

tensorflow/python/framework/ops.py:2009–2022  ·  view source on GitHub ↗

Fast path to set device if the type is known to be a string. This function is called frequently enough during graph construction that there are non-trivial performance gains if the caller can guarantee that the specified device is already a string. Args: device_str: A string

(self, device_str)

Source from the content-addressed store, hash-verified

2007 self._set_device_from_string(compat.as_str(_device_string(device)))
2008
2009 def _set_device_from_string(self, device_str):
2010 """Fast path to set device if the type is known to be a string.
2011
2012 This function is called frequently enough during graph construction that
2013 there are non-trivial performance gains if the caller can guarantee that
2014 the specified device is already a string.
2015
2016 Args:
2017 device_str: A string specifying where to place this op.
2018 """
2019 c_api.SetRequestedDevice(
2020 self._graph._c_graph, # pylint: disable=protected-access
2021 self._c_op, # pylint: disable=protected-access
2022 device_str)
2023
2024 def _update_input(self, index, tensor):
2025 """Update the input to this operation at the given index.

Callers 2

_set_deviceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected