void _assign_moving_average(IVariableV1 variable, Tensor value, Tensor momentum) { tf_with(ops.name_scope("AssignMovingAvg", null, new { variable, value, momentum }), scope => { // var cm = ops.colocate_with(variable); var decay = ops.convert_to_tensor(1.0f - momentum, name: "decay"); var update_delta = (variable.AsTensor() - math_ops.cast(value, variable.dtype)) * decay; variable.assign_sub_lazy_load(update_delta, name: scope); }); }