def _read_variable_op(self): """Reads the value of this variable.""" if self.trainable: tape.variable_accessed(self) handle = self.handle if getattr(handle, "is_packed", False): # Add a device scope for a packed variable handle. with ops.device(self._get_on_device_or_primary().device): return gen_resource_variable_ops.read_variable_op(handle, self.dtype) else: return gen_resource_variable_ops.read_variable_op(handle, self.dtype)
def _read_variable_op(self): if self.trainable: tape.variable_accessed(self) return gen_resource_variable_ops.read_variable_op( self.handle, self.dtype)