def WeightMask(target, mask_id=0, **kw): del kw if mask_id is None: return np.ones_like(target) return 1.0 - np.equal(target, mask_id).astype(np.float32)
def Accuracy(x, axis=-1, **kw): del kw prediction, target = x predicted_class = np.argmax(prediction, axis=axis) return np.equal(predicted_class, target)