def _get_weights(self, hessian_shape, hessians):
    'Derives weights to be used based on hessians and multiclass strategy.'
    if (hessian_shape == tensor_shape.scalar()):
        weights = hessians
    elif (len(hessian_shape.dims) == 1):
        weights = math_ops.reduce_sum(hessians, axis=1)
    else:
        weights = math_ops.trace(hessians)
    return weights
Derives weights to be used based on hessians and multiclass strategy.
def _get_weights(self, hessian_shape, hessians):
    
    if (hessian_shape == tensor_shape.scalar()):
        weights = hessians
    elif (len(hessian_shape.dims) == 1):
        weights = math_ops.reduce_sum(hessians, axis=1)
    else:
        weights = math_ops.trace(hessians)
    return weights