MCPcopy Create free account
hub / github.com/apache/singa / device_check

Method device_check

python/singa/opt.py:146–154  ·  view source on GitHub ↗
(self, *inputs)

Source from the content-addressed store, hash-verified

144 self.apply(param.name, param, grad)
145
146 def device_check(self, *inputs):
147 flag = inputs[0].device.graph_enabled()
148 inputs[0].device.EnableGraph(False)
149 x_device = inputs[0].device
150 x_dev_id = x_device.id()
151 for var in inputs:
152 if var.device.id() != x_dev_id:
153 var.to_device(x_device)
154 inputs[0].device.EnableGraph(flag)
155
156 @deprecated(
157 reason=

Callers 4

applyMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45

Calls 4

graph_enabledMethod · 0.80
EnableGraphMethod · 0.80
idMethod · 0.45
to_deviceMethod · 0.45

Tested by

no test coverage detected