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

Method replace

tensorflow/python/framework/device_spec.py:217–239  ·  view source on GitHub ↗

Convenience method for making a new DeviceSpec by overriding fields. For instance: ``` my_spec = DeviceSpec=(job="my_job", device="CPU") my_updated_spec = my_spec.replace(device="GPU") my_other_spec = my_spec.replace(device=None) ``` Args: **kwargs: This method ta

(self, **kwargs)

Source from the content-addressed store, hash-verified

215 return self.__class__(*self._get_combined_properties(dev))
216
217 def replace(self, **kwargs):
218 """Convenience method for making a new DeviceSpec by overriding fields.
219
220 For instance:
221 ```
222 my_spec = DeviceSpec=(job="my_job", device="CPU")
223 my_updated_spec = my_spec.replace(device="GPU")
224 my_other_spec = my_spec.replace(device=None)
225 ```
226
227 Args:
228 **kwargs: This method takes the same args as the DeviceSpec constructor
229
230 Returns:
231 A DeviceSpec with the fields specified in kwargs overridden.
232 """
233 init_kwargs = dict(
234 job=self.job, replica=self.replica, task=self.task,
235 device_type=self.device_type, device_index=self.device_index)
236
237 # Explicitly provided kwargs take precidence.
238 init_kwargs.update(kwargs)
239 return self.__class__(**init_kwargs)
240
241 @property
242 def job(self):

Callers 15

sed_in_placeFunction · 0.80
cygpathFunction · 0.80
create_android_sdk_ruleFunction · 0.80
get_ndk_api_levelFunction · 0.80
_emit_tensor_snapshotMethod · 0.80
StringReplaceFunction · 0.80
run_and_gather_logsFunction · 0.80
_gather_gpu_devices_procFunction · 0.80
gather_cpu_infoFunction · 0.80
write_docsFunction · 0.80
_generate_signatureFunction · 0.80
mkdir_and_copy_fileMethod · 0.80

Calls 1

updateMethod · 0.45

Tested by 15

conversion_visitorMethod · 0.64
_restore_map_funcMethod · 0.64
configMethod · 0.64
parserFunction · 0.64
test_replaceMethod · 0.64
test_reprMethod · 0.64
test_reflexiveMethod · 0.64