def test_nopscaler(target, observed): s = scaler.NOPScaler() target_scaled, scale = s(target, observed) assert mx.nd.norm(target - target_scaled) == 0 assert mx.nd.norm(mx.nd.ones_like(target).mean(axis=s.axis) - scale) == 0
1e-6 * mx.nd.ones(shape=(5, 3)), ), ( scaler.MeanScaler(minimum_scale=1e-6), mx.nd.random.normal(shape=(5, 30, 1)), mx.nd.zeros(shape=(5, 30, 1)), 1e-6 * mx.nd.ones(shape=(5, 1)), ), ( scaler.MeanScaler(minimum_scale=1e-12), mx.nd.random.normal(shape=(5, 30, 3)), mx.nd.zeros(shape=(5, 30, 3)), 1e-12 * mx.nd.ones(shape=(5, 3)), ), ( scaler.NOPScaler(), mx.nd.random.normal(shape=(10, 20, 30)), mx.nd.random.normal(shape=(10, 20, 30)) > 0, mx.nd.ones(shape=(10, 30)), ), ( scaler.NOPScaler(), mx.nd.random.normal(shape=(10, 20, 30)), mx.nd.ones(shape=(10, 20, 30)), mx.nd.ones(shape=(10, 30)), ), ( scaler.NOPScaler(), mx.nd.random.normal(shape=(10, 20, 30)), mx.nd.zeros(shape=(10, 20, 30)), mx.nd.ones(shape=(10, 30)),