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

Method from_string

tensorflow/python/framework/device_spec.py:124–138  ·  view source on GitHub ↗

Construct a `DeviceSpec` from a string. Args: spec: a string of the form /job: /replica: /task: /device:CPU: or /job: /replica: /task: /device:GPU: as cpu and gpu are mutually exclusive. All entries are optional. Returns:

(cls, spec)

Source from the content-addressed store, hash-verified

122
123 @classmethod
124 def from_string(cls, spec):
125 """Construct a `DeviceSpec` from a string.
126
127 Args:
128 spec: a string of the form
129 /job:<name>/replica:<id>/task:<id>/device:CPU:<id>
130 or
131 /job:<name>/replica:<id>/task:<id>/device:GPU:<id>
132 as cpu and gpu are mutually exclusive.
133 All entries are optional.
134
135 Returns:
136 A DeviceSpec.
137 """
138 return cls(*cls._string_to_components(spec))
139
140 def parse_from_string(self, spec):
141 """Parse a `DeviceSpec` name into its components.

Callers 15

parse_from_stringMethod · 0.95
_train_batch_sizesMethod · 0.80
_reportMethod · 0.80
_train_batch_sizesMethod · 0.80
_reportMethod · 0.80
_train_batch_sizesMethod · 0.80
_reportMethod · 0.80
initialize_tpu_systemFunction · 0.80
_sort_keyFunction · 0.80
testManyCPUsMethod · 0.80
_ProcessNewOpsFunction · 0.80

Calls 1

_string_to_componentsMethod · 0.80

Tested by 12

_train_batch_sizesMethod · 0.64
_reportMethod · 0.64
_train_batch_sizesMethod · 0.64
_reportMethod · 0.64
_train_batch_sizesMethod · 0.64
_reportMethod · 0.64
testManyCPUsMethod · 0.64
test_to_from_stringMethod · 0.64
test_merge_legacyMethod · 0.64
test_merge_removedMethod · 0.64
test_combineMethod · 0.64
testMergeMethod · 0.64