Skip to content

Commit 948dedd

Browse files
h-joocopybara-github
authored andcommitted
Automated Code Change
PiperOrigin-RevId: 944173080
1 parent fbf3c70 commit 948dedd

15 files changed

Lines changed: 36 additions & 36 deletions

MaxCode/evaluation/code_agent/test_cases/level2/test_GRU.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def test_jax_independent():
7878

7979
expected_shape = (CONFIG['batch_size'], CONFIG['output_size'])
8080
assert (
81-
y.shape == expected_shape
81+
y.shape == expected_shape # pyrefly: ignore[missing-attribute]
8282
), f'JAX Shape Mismatch: Expected {expected_shape}, got {y.shape}'
83-
assert not jnp.isnan(y).any(), 'JAX Output contains NaNs'
83+
assert not jnp.isnan(y).any(), 'JAX Output contains NaNs' # pyrefly: ignore[bad-argument-type]
8484

8585

8686
def main(argv: Sequence[str]):

MaxCode/evaluation/code_agent/test_cases/level2/test_GenerativeAdversarialNetwork.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,23 @@ def test_jax_validity():
7272
gen_params = generator.init(key, dummy_z)
7373
gen_out = generator.apply(gen_params, dummy_z, train=False)
7474
expected_gen_shape = (batch_size, int(np.prod(img_shape)))
75-
assert gen_out.shape == expected_gen_shape, (
75+
assert gen_out.shape == expected_gen_shape, ( # pyrefly: ignore[missing-attribute]
7676
f'JAX Generator Shape Mismatch: Expected {expected_gen_shape}, got'
7777
f' {gen_out.shape}'
7878
)
79-
assert not jnp.isnan(gen_out).any(), 'JAX Generator Output contains NaNs'
79+
assert not jnp.isnan(gen_out).any(), 'JAX Generator Output contains NaNs' # pyrefly: ignore[bad-argument-type]
8080

8181
# Test Discriminator
8282
discriminator = model_jax.Discriminator()
8383
dummy_img = jnp.zeros((batch_size, *img_shape))
8484
disc_params = discriminator.init(key, dummy_img)
8585
disc_out = discriminator.apply(disc_params, dummy_img)
8686
expected_disc_shape = (batch_size, 1)
87-
assert disc_out.shape == expected_disc_shape, (
87+
assert disc_out.shape == expected_disc_shape, ( # pyrefly: ignore[missing-attribute]
8888
f'JAX Discriminator Shape Mismatch: Expected {expected_disc_shape}, got'
8989
f' {disc_out.shape}'
9090
)
91-
assert not jnp.isnan(disc_out).any(), 'JAX Discriminator Output contains NaNs'
91+
assert not jnp.isnan(disc_out).any(), 'JAX Discriminator Output contains NaNs' # pyrefly: ignore[bad-argument-type]
9292

9393

9494
def test_generator_equivalence():
@@ -148,7 +148,7 @@ def copy_bn(torch_layer, jax_layer_name):
148148
out_jax = jax_model.apply(params, z_jax, train=False)
149149

150150
print(f'Generator Output Max Diff: {np.max(np.abs(out_torch - out_jax))}')
151-
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5)
151+
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5) # pyrefly: ignore[no-matching-overload]
152152
print('Generator Equivalence: PASS')
153153

154154

@@ -196,7 +196,7 @@ def copy_linear(torch_layer, jax_layer_name):
196196
out_jax = jax_model.apply(params, img_jax)
197197

198198
print(f'Discriminator Output Max Diff: {np.max(np.abs(out_torch - out_jax))}')
199-
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5)
199+
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5) # pyrefly: ignore[no-matching-overload]
200200
print('Discriminator Equivalence: PASS')
201201

202202

MaxCode/evaluation/code_agent/test_cases/level2/test_GraphConvolution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def test_jax_independent():
6565
expected_shape = (CONFIG["n_nodes"], CONFIG["out_features"])
6666

6767
assert (
68-
out.shape == expected_shape
68+
out.shape == expected_shape # pyrefly: ignore[missing-attribute]
6969
), f"JAX Shape Mismatch: Expected {expected_shape}, got {out.shape}"
70-
assert not jnp.isnan(out).any(), "JAX Output contains NaNs"
70+
assert not jnp.isnan(out).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
7171

7272

7373
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_LSTMAttentionForecaster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def test_jax_independent():
7474

7575
expected_shape = (CONFIG["batch_size"], CONFIG["output_size"])
7676
assert (
77-
y.shape == expected_shape
77+
y.shape == expected_shape # pyrefly: ignore[missing-attribute]
7878
), f"JAX Shape Mismatch: Expected {expected_shape}, got {y.shape}"
79-
assert not jnp.isnan(y).any(), "JAX Output contains NaNs"
79+
assert not jnp.isnan(y).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
8080

8181

8282
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_LSTMForecaster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def test_jax_independent():
7777

7878
expected_shape = (CONFIG["batch_size"], CONFIG["output_size"])
7979
assert (
80-
y.shape == expected_shape
80+
y.shape == expected_shape # pyrefly: ignore[missing-attribute]
8181
), f"JAX Shape Mismatch: Expected {expected_shape}, got {y.shape}"
82-
assert not jnp.isnan(y).any(), "JAX Output contains NaNs"
82+
assert not jnp.isnan(y).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
8383

8484

8585
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_MLP.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def test_jax_independent():
7373
# Checks
7474
expected_shape = (TEST_CONFIG["batch_size"], 1)
7575
assert (
76-
y.shape == expected_shape
76+
y.shape == expected_shape # pyrefly: ignore[missing-attribute]
7777
), f"JAX Shape Mismatch: Expected {expected_shape}, got {y.shape}"
78-
assert not jnp.isnan(y).any(), "JAX Output contains NaNs"
78+
assert not jnp.isnan(y).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
7979

8080

8181
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_SelfAttention.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def test_jax_independent():
8484
config["embed_size"],
8585
)
8686
assert (
87-
out.shape == expected_shape
87+
out.shape == expected_shape # pyrefly: ignore[missing-attribute]
8888
), f"JAX Shape Mismatch: Expected {expected_shape}, got {out.shape}"
89-
assert not jnp.isnan(out).any(), "JAX Output contains NaNs"
89+
assert not jnp.isnan(out).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
9090
return True
9191

9292

@@ -143,7 +143,7 @@ def copy_layer(pt_layer, jax_name):
143143
print(f" >> Head Dim: {head_dim}, Scaling Factor: {scale}")
144144

145145
# Final Assertion
146-
np.testing.assert_allclose(pt_out, jax_out, rtol=1e-4, atol=1e-5)
146+
np.testing.assert_allclose(pt_out, jax_out, rtol=1e-4, atol=1e-5) # pyrefly: ignore[no-matching-overload]
147147
return True
148148

149149

MaxCode/evaluation/code_agent/test_cases/level2/test_SimpleCNN.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def test_jax_model_validity():
5252
params = model.init(key, dummy_input)
5353
output = model.apply(params, dummy_input)
5454

55-
assert output.shape == (
55+
assert output.shape == ( # pyrefly: ignore[missing-attribute]
5656
4,
5757
10,
5858
), f'Expected output shape (4, 10), got {output.shape}'
59-
assert not jnp.isnan(output).any(), 'Output contains NaNs'
59+
assert not jnp.isnan(output).any(), 'Output contains NaNs' # pyrefly: ignore[bad-argument-type]
6060

6161

6262
def test_pytorch_jax_equivalence():
@@ -130,7 +130,7 @@ def get_b(layer):
130130
diff = np.abs(out_torch - jax_numpy)
131131
max_diff = np.max(diff)
132132
print(f'\n >> Max Absolute Difference: {max_diff:.2e}')
133-
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5)
133+
np.testing.assert_allclose(out_torch, out_jax, rtol=1e-5, atol=1e-5) # pyrefly: ignore[no-matching-overload]
134134

135135

136136
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_SimpleRNN.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def test_jax_independent():
4545
x = jnp.ones((2, 5, 4))
4646
variables = model.init(jax.random.PRNGKey(42), x)
4747
y = model.apply(variables, x)
48-
assert y.shape == (2, 3)
49-
assert not jnp.isnan(y).any()
48+
assert y.shape == (2, 3) # pyrefly: ignore[missing-attribute]
49+
assert not jnp.isnan(y).any() # pyrefly: ignore[bad-argument-type]
5050

5151

5252
def test_rnn_equivalence(
@@ -118,7 +118,7 @@ def test_rnn_equivalence(
118118
diff = np.abs(pt_out - jax_numpy)
119119
max_diff = np.max(diff)
120120
print(f'\n >> Max Absolute Difference: {max_diff:.2e}')
121-
np.testing.assert_allclose(pt_out, jax_out, rtol=1e-5, atol=1e-5)
121+
np.testing.assert_allclose(pt_out, jax_out, rtol=1e-5, atol=1e-5) # pyrefly: ignore[no-matching-overload]
122122

123123

124124
# pylint: disable=unused-argument

MaxCode/evaluation/code_agent/test_cases/level2/test_TCU.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def test_jax_independent():
7272
)
7373

7474
assert (
75-
y.shape == expected_shape
75+
y.shape == expected_shape # pyrefly: ignore[missing-attribute]
7676
), f"JAX Shape Mismatch: Expected {expected_shape}, got {y.shape}"
77-
assert not jnp.isnan(y).any(), "JAX Output contains NaNs"
77+
assert not jnp.isnan(y).any(), "JAX Output contains NaNs" # pyrefly: ignore[bad-argument-type]
7878

7979

8080
# pylint: disable=unused-argument

0 commit comments

Comments
 (0)