def update_global_step_op(self): global_step = get_global_step() update_op = xdl.ps_assign_add_op( var_name = global_step.name, var_type = global_step.vtype, delta = np.array(1, dtype=np.int64)) return update_op
def test_all(self): var = xdl.Variable(name="w", dtype=DataType.int32, shape=[4], initializer=xdl.Zeros()) execute(xdl.variable_registers()) execute(xdl.global_initializers()) op = xdl.ps_assign_add_op(var_name="w", var_type="index", delta=np.array([1,2,3,4], dtype=np.int32)) execute(op) ret = execute(var.value) self.assertTrue((ret == np.array([1,2,3,4])).all())
def before_run(self, v): if self._ckpt_dir is None: return [] if (self._is_training): return self._global_step.value else: update_op = xdl.ps_assign_add_op(var_name=self._global_step.name, var_type=self._global_step.vtype, delta=np.array(1, dtype=np.int64)) return [self._global_step.value, update_op]
def _update_auc(var, delta): return xdl.ps_assign_add_op(var_name=var.name, var_type=var.vtype, delta=delta)