mse

paddle.distributed.fleet.metrics.metric. mse ( sqrerr, total_ins_num, scope=None, util=None ) [source]

distributed mse in fleet

Parameters
  • sqrerr (numpy.array|Variable|string) – sqrerr in output of fluid.contrib.layers.ctr_metric_bundle

  • total_ins_num (numpy.array|Variable|string) – total variable

  • scope (Scope) – specific scope

Returns

mse value

Return type

mse(float)

Example

# in model.py
sqrerr, abserr, prob, q, pos, total = fluid.contrib.layers.ctr_metric_bundle(similarity_norm, fluid.layers.cast(x=label, dtype='float32'))

# in train.py, after train or infer
metric = np.array(scope.find_var(sqrerr.name).get_tensor())
print("mse: ", paddle.distributed.fleet.mse(metric, total_ins_num))