@classmethod
def get_scales(cls, grads, losses, normalization_type, tasks):
    scale = {}
    gn = gradient_normalizers(grads, losses, normalization_type)
    for t in tasks:
        for gr_i in range(len(grads[t])):
            grads[t][gr_i] = (grads[t][gr_i] / (gn[t] + 1e-05))
    (sol, min_norm) = cls.find_min_norm_element([grads[t] for t in tasks])
    for (zi, t) in enumerate(tasks):
        scale[t] = float(sol[zi])
    return scale
@classmethod
def get_scales(cls, grads, losses, normalization_type, tasks):
    scale = {}
    gn = gradient_normalizers(grads, losses, normalization_type)
    for t in tasks:
        for gr_i in range(len(grads[t])):
            grads[t][gr_i] = (grads[t][gr_i] / (gn[t] + 1e-05))
    (sol, min_norm) = cls.find_min_norm_element([grads[t] for t in tasks])
    for (zi, t) in enumerate(tasks):
        scale[t] = float(sol[zi])
    return scale