mae

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

distributed mae in fleet

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

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

  • scope (Scope) – specific scope

Returns

mae value

Return type

mae(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
res = np.array(scope.find_var(abserr.name).get_tensor())
print("mae: ", paddle.distributed.fleet.mae(res, total_ins_num))