repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/metrics/test_graph_eval_metrics.py
test_graph_eval_metrics
assert
collection
83
import pytest import torch from causica.graph.evaluation_metrics import ( adjacency_f1, adjacency_precision_recall, orientation_f1, orientation_precision_recall, ) MATRICES = [ torch.tensor([[0, 1, 1], [0, 0, 0], [0, 0, 0]]), torch.tensor([[0, 0, 0], [1, 0, 0], [1, 0, 0]]), torch.tensor([[...
( adj_metrics["adjacency_precision"], adj_metrics["adjacency_recall"], )
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/metrics/test_graph_eval_metrics.py
test_graph_eval_metrics
assert
collection
78
import pytest import torch from causica.graph.evaluation_metrics import ( adjacency_f1, adjacency_precision_recall, orientation_f1, orientation_precision_recall, ) MATRICES = [ torch.tensor([[0, 1, 1], [0, 0, 0], [0, 0, 0]]), torch.tensor([[0, 0, 0], [1, 0, 0], [1, 0, 0]]), torch.tensor([[...
( orientation_metrics["orientation_precision"], orientation_metrics["orientation_recall"], )
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/nn/test_deci_embed_nn.py
test_fgnni_broadcast
assert
func_call
30
import pytest import torch from causica.nn import DECIEmbedNN PROCESSED_DIM = 6 NODE_NUM = 4 GROUP_MASK = torch.tensor( [ [1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], ], dtype=torch.float32, ) GRAPH_SHAPES = [tuple(), (5,), (2, 3)] SAMPLE...
sample_shape + graph_shape + (PROCESSED_DIM,)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_sem.py
test_do_linear_sem_bernoulli
assert_*
complex_expr
48
import pytest import torch import torch.distributions as td from tensordict import TensorDict from causica.datasets.variable_types import VariableTypeEnum from causica.distributions import JointNoiseModule, create_noise_modules from causica.distributions.noise.joint import ContinuousNoiseDist from causica.functional_r...
sample["x1"])
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_sem.py
test_do_linear_sem_bernoulli
assert_*
variable
41
import pytest import torch import torch.distributions as td from tensordict import TensorDict from causica.datasets.variable_types import VariableTypeEnum from causica.distributions import JointNoiseModule, create_noise_modules from causica.distributions.noise.joint import ContinuousNoiseDist from causica.functional_r...
expected_log_probs)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_sem.py
test_do_linear_sem_bernoulli
assert_*
collection
46
import pytest import torch import torch.distributions as td from tensordict import TensorDict from causica.datasets.variable_types import VariableTypeEnum from causica.distributions import JointNoiseModule, create_noise_modules from causica.distributions.noise.joint import ContinuousNoiseDist from causica.functional_r...
((expected_logits + noise["x1"]) > 0).float())
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_treatment_effects.py
test_ate_ite_cf_three_node
assert_*
complex_expr
39
import math import pytest import torch from tensordict import TensorDict from causica.sem.structural_equation_model import ate, counterfactual, ite from . import create_lingauss_sem def fixture_two_variable_dict(): return {"x1": torch.Size([1]), "x2": torch.Size([2])} def fixture_three_variable_dict(): ret...
factual_data["x1"])
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_treatment_effects.py
test_ate_ite_cf_two_node
assert_*
variable
34
import math import pytest import torch from tensordict import TensorDict from causica.sem.structural_equation_model import ate, counterfactual, ite from . import create_lingauss_sem def fixture_two_variable_dict(): return {"x1": torch.Size([1]), "x2": torch.Size([2])} def fixture_three_variable_dict(): ret...
expected_treatment_effect)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_treatment_effects.py
test_ate_ite_cf_two_node
assert_*
func_call
39
import math import pytest import torch from tensordict import TensorDict from causica.sem.structural_equation_model import ate, counterfactual, ite from . import create_lingauss_sem def fixture_two_variable_dict(): return {"x1": torch.Size([1]), "x2": torch.Size([2])} def fixture_three_variable_dict(): ret...
expected_mean_a.expand((sample_size, 1)))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_treatment_effects.py
test_ate_ite_cf_three_node
assert_*
func_call
27
import math import pytest import torch from tensordict import TensorDict from causica.sem.structural_equation_model import ate, counterfactual, ite from . import create_lingauss_sem def fixture_two_variable_dict(): return {"x1": torch.Size([1]), "x2": torch.Size([2])} def fixture_three_variable_dict(): ret...
torch.zeros_like(average_treatment_effect["x1"]))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/sem/test_treatment_effects.py
test_ate_ite_cf_two_node
assert_*
func_call
38
import math import pytest import torch from tensordict import TensorDict from causica.sem.structural_equation_model import ate, counterfactual, ite from . import create_lingauss_sem def fixture_two_variable_dict(): return {"x1": torch.Size([1]), "x2": torch.Size([2])} def fixture_three_variable_dict(): ret...
expected_treatment_effect.expand((sample_size, 1)))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_dag_constraint.py
test_calculate_dagness
assert
numeric_literal
11
import numpy as np import torch from causica.graph.dag_constraint import calculate_dagness def test_calculate_dagness(): dag = torch.Tensor([[0, 0, 1], [0, 0, 1], [0, 0, 0]]) assert calculate_dagness(dag) ==
0
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_dag_constraint.py
test_calculate_dagness
assert_*
func_call
22
import numpy as np import torch from causica.graph.dag_constraint import calculate_dagness def test_calculate_dagness(): dag = torch.Tensor([[0, 0, 1], [0, 0, 1], [0, 0, 0]]) assert calculate_dagness(dag) == 0 dag_one_cycle = torch.Tensor([[0, 1, 0], [0, 0, 1], [1, 0, 0]]) dag_two_cycle = torch.Te...
2 * np.exp(1) - 2)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_dag_constraint.py
test_calculate_dagness
assert
func_call
19
import numpy as np import torch from causica.graph.dag_constraint import calculate_dagness def test_calculate_dagness(): dag = torch.Tensor([[0, 0, 1], [0, 0, 1], [0, 0, 0]]) assert calculate_dagness(dag) == 0 dag_one_cycle = torch.Tensor([[0, 1, 0], [0, 0, 1], [1, 0, 0]]) dag_two_cycle = torch.Te...
calculate_dagness(dag_two_cycle)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_unfill_fill
assert_*
variable
16
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_unfill_fill(batch_size): """Test that unfilling and filling results in the same tensor""" vec = torch.randn(batch_size ...
vec)
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_unfill_fill
assert_*
func_call
18
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_unfill_fill(batch_size): """Test that unfilling and filling results in the same tensor""" vec = torch.randn(batch_size ...
torch.zeros_like(vec))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_fill_unfill
assert_*
func_call
17
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_fill_unfill(batch_size): """Test that filling and unfilling results in the same tensor""" matrix = torch.randn(batch_si...
fill_triangular(upper_vec, upper=True))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_fill_unfill
assert_*
func_call
18
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_fill_unfill(batch_size): """Test that filling and unfilling results in the same tensor""" matrix = torch.randn(batch_si...
fill_triangular(lower_vec, upper=True))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_fill_unfill
assert_*
func_call
16
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_fill_unfill(batch_size): """Test that filling and unfilling results in the same tensor""" matrix = torch.randn(batch_si...
fill_triangular(lower_vec, upper=False))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/test_triangular_transformations.py
test_fill_unfill
assert_*
func_call
21
import pytest import torch from causica.triangular_transformations import fill_triangular, unfill_triangular DIM = 5 @pytest.mark.parametrize("batch_size", [tuple(), (3,), (4, 2)]) def test_fill_unfill(batch_size): """Test that filling and unfilling results in the same tensor""" matrix = torch.randn(batch_si...
fill_triangular(upper_vec, upper=False))
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/causica
f20772bf4e2d104aea043f66226b35d2527640f9
15
train
train
test/training/test_auglag.py
test_solve_auglag
assert
numeric_literal
79
import torch from torch.nn import Parameter from torch.optim import Adam from causica.training.auglag import AugLagLossCalculator, AugLagLR, AugLagLRConfig def _get_auglag_config(lr_init_dict: dict[str, float]): return AugLagLRConfig( lr_update_lag=1, lr_update_lag_best=100, lr_init_dict=l...
1e-3
f20772bf4e2d104aea043f66226b35d2527640f9
15
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/data_utils_test.py
check_invariance
assert
numeric_literal
164
from collections import Counter from itertools import product from typing import Dict, Optional, Tuple import numpy as np import pytest import torch from pymatgen.core.structure import Structure from pymatgen.transformations.standard_transformations import RotationTransformation from mattergen.common.tests.testutils ...
1
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/data_utils_test.py
get_distances_numpy
assert
variable
239
from collections import Counter from itertools import product from typing import Dict, Optional, Tuple import numpy as np import pytest import torch from pymatgen.core.structure import Structure from pymatgen.transformations.standard_transformations import RotationTransformation from mattergen.common.tests.testutils ...
dtype
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/data_utils_test.py
test_pbc_graph_translation_invariant
assert
variable
82
from collections import Counter from itertools import product from typing import Dict, Optional, Tuple import numpy as np import pytest import torch from pymatgen.core.structure import Structure from pymatgen.transformations.standard_transformations import RotationTransformation from mattergen.common.tests.testutils ...
counter2
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/data_utils_test.py
test_torch_nanstd
assert
func_call
264
from collections import Counter from itertools import product from typing import Dict, Optional, Tuple import numpy as np import pytest import torch from pymatgen.core.structure import Structure from pymatgen.transformations.standard_transformations import RotationTransformation from mattergen.common.tests.testutils ...
np.nanstd(x.numpy())
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/gemnet_test.py
test_lattice_score_scale_invariance
assert
none_literal
149
from copy import deepcopy from itertools import chain, permutations from typing import List, Tuple import torch from pymatgen.core.structure import Structure from scipy.spatial.transform import Rotation from torch_geometric.data import Batch, Data from mattergen.common.gemnet.gemnet import GemNetT from mattergen.comm...
None
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/common/tests/gemnet_test.py
test_nonconservative_lattice_score_translation_invariance
assert_*
complex_expr
139
from copy import deepcopy from itertools import chain, permutations from typing import List, Tuple import torch from pymatgen.core.structure import Structure from scipy.spatial.transform import Rotation from torch_geometric.data import Batch, Data from mattergen.common.gemnet.gemnet import GemNetT from mattergen.comm...
out_translated.stress)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_collate_fn
assert
none_literal
15
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_collate_fn(): """Collate two pieces of data""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat...
None
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_to_data_list
assert
string_literal
14
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_to_data_list(): """Collate and then unpack two pieces of data.""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ...
"data1"
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_to_data_list
assert
string_literal
17
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_to_data_list(): """Collate and then unpack two pieces of data.""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ...
"data2"
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_to_data_list
assert
collection
15
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_to_data_list(): """Collate and then unpack two pieces of data.""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ...
[10, 11]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_to_data_list
assert
collection
13
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_to_data_list(): """Collate and then unpack two pieces of data.""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ...
[[1, 2, 3]]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_to_data_list
assert
collection
12
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_to_data_list(): """Collate and then unpack two pieces of data.""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, ...
[1, 2, 3, 4]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_collate_fn
assert
collection
13
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_collate_fn(): """Collate two pieces of data""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat...
["data1", "data2"]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_collate_fn
assert
collection
14
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_collate_fn(): """Collate two pieces of data""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat...
[0, 0, 0, 0, 1, 1]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/data/test_batched_data.py
test_collate_fn
assert
collection
11
import torch from mattergen.diffusion.data.batched_data import collate_fn def test_collate_fn(): """Collate two pieces of data""" data1 = {"a": torch.tensor([1, 2, 3, 4]), "b": torch.tensor([[1, 2, 3]]), "name": "data1"} data2 = {"a": torch.tensor([10, 11]), "b": torch.tensor([[10, 11, 12]]), "name": "dat...
[1, 2, 3, 4, 10, 11]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_sample_and_posterior
assert
collection
31
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_sample_and_posterior(): """Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling.""" schedule = diffusion.create_discrete_diffusion_sche...
(1,)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_model
assert_*
numeric_literal
35
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_model(): """Test the Diffusion noise diffusion.""" schedule = diffusion.create_discrete_diffusion_schedule( kind="standard", beta_min=1e-3, beta_max=1e-3, ...
1.0)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_loss_computation
assert
complex_expr
45
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_loss_computation(): """Tests whether the loss computation uses the right terms (KL / cross-entropy) and broadcasts correctly.""" torch.manual_seed(234) num_steps = 100 num_cl...
t.shape
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_sample_and_posterior
assert
collection
28
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_sample_and_posterior(): """Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling.""" schedule = diffusion.create_discrete_diffusion_sche...
(1, 100)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_compute_posterior
assert
collection
25
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_compute_posterior(): """Tests that the forward diffusion probabilities are correct for t=0.""" schedule = diffusion.create_discrete_diffusion_schedule( kind="linear", ...
(2, 100)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_mask_diffusion_slow_and_fast
assert_*
variable
28
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_mask_diffusion_slow_and_fast(): """Compares fast and slow inference for mask diffusion.""" schedule = diffusion.create_discrete_diffusion_schedule( kind="standard", b...
qt_fast)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_product_constant
assert_*
variable
33
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_product_constant(): """Tests, when we have a constant beta schedule (transition probabilities don't change over time), whether the transition matrices computed via q(x_t | x_0) and q...
expected)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_mask_diffusion_slow_and_fast
assert_*
variable
43
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_mask_diffusion_slow_and_fast(): """Compares fast and slow inference for mask diffusion.""" schedule = diffusion.create_discrete_diffusion_schedule( kind="standard", b...
samples_fast)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_sample_and_posterior
assert_*
func_call
32
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_sample_and_posterior(): """Tests whether the samples and posterior are as expected when providing timestep 0 for the sampling.""" schedule = diffusion.create_discrete_diffusion_sche...
np.array([1]))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_d3pm.py
test_product_the_hard_way
assert_*
func_call
26
import functools import numpy as np import pytest import torch from mattergen.diffusion.d3pm import d3pm as diffusion def test_product_the_hard_way(): """Tests that the discrete transition matrices computed via q(x_t | x_0) and q(x_t|x_{t-1}) are equivalent for t in {0, 1}. Uses the slow iterative method of ...
torch.eye(100))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_data_utils.py
test_collate_fn
assert
numeric_literal
38
import torch from mattergen.diffusion.data.batched_data import SimpleBatchedData, _batch_edge_index, collate_fn def test_collate_fn(): state1 = dict(foo=torch.ones(2, 3), bar=torch.ones(5, 2)) state2 = dict(foo=torch.zeros(3, 3), bar=torch.zeros(2, 2)) batch = collate_fn([state1, state2]) field_names...
2
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_data_utils.py
test_batch_edge_index
assert_*
func_call
12
import torch from mattergen.diffusion.data.batched_data import SimpleBatchedData, _batch_edge_index, collate_fn def test_batch_edge_index(): edge_index = torch.tensor( [[0, 1], [0, 2], [1, 2], [0, 1], [0, 3], [1, 2], [2, 3], [0, 1], [1, 3]] ) atom_batch_idx = torch.tensor([0, 0, 1, 1, 1, 1, 1, 2, ...
torch.tensor([[0, 1], [0, 2], [1, 2], [2, 3], [2, 5], [3, 4], [4, 5], [7, 8], [8, 10]]))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_calc_loss
assert_*
variable
67
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
target_loss)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_calc_loss
assert_*
complex_expr
86
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
target_loss * 4)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_weighted_summed_field_loss
assert_*
variable
86
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
unweighted_loss)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_calc_loss
assert_*
variable
74
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
loss_with_bad_bar)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_weighted_summed_field_loss
assert_*
func_call
82
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
torch.stack([weighted_loss_per_field[k] for k in weighted_loss_per_field.keys()]))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_wrapped_normal_loss
assert_*
func_call
77
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
torch.stack([non_wrapped_loss_per_field[k] for k in non_wrapped_loss_per_field.keys()]))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_losses.py
test_weighted_summed_field_loss
assert_*
complex_expr
77
from functools import partial from typing import Dict, List, Type import pytest import torch from mattergen.diffusion.corruption.corruption import Corruption from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusi...
unweighted_loss_per_field["foo"] * weights["foo"] + unweighted_loss_per_field["bar"] * weights["bar"])
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_multi_corruption.py
_assert_keys
assert
collection
20
from typing import Any, Dict, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_keys_shapes(multi_corruption: MultiCorruption, batch, t:...
{"foo", "bar"}
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_multi_corruption.py
_check_keys_shapes
assert
complex_expr
16
from typing import Any, Dict, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_keys_shapes(multi_corruption: MultiCorruption, batch, t:...
batch[k].shape
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_multi_corruption.py
_check_keys_shapes
assert
complex_expr
17
from typing import Any, Dict, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_keys_shapes(multi_corruption: MultiCorruption, batch, t:...
batch[k].shape[0]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_reverse_sampling.py
test_wrapped_reverse_sampling
assert
numeric_literal
98
from argparse import Namespace from contextlib import nullcontext from functools import partial from typing import List, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.data.batc...
0.0
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_reverse_sampling.py
test_wrapped_reverse_sampling
assert
variable
97
from argparse import Namespace from contextlib import nullcontext from functools import partial from typing import List, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.data.batc...
wrapping_boundary
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_reverse_sampling.py
test_reverse_sampling
pytest.raises
variable
75
from argparse import Namespace from contextlib import nullcontext from functools import partial from typing import List, Type import pytest import torch from mattergen.diffusion.corruption.multi_corruption import MultiCorruption from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.data.batc...
IncompatibleSampler)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sampling.py
test_predictor
assert
complex_expr
81
from collections import defaultdict from contextlib import nullcontext from typing import Callable, Dict, List, Type, Union import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE, VESDE, VPSDE from mattergen.diffusion.d3pm.d3pm_predictors_correctors import D3PMAncestralSamplingPredictor fro...
x_mean.shape
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sampling.py
test_predictor
pytest.raises
variable
62
from collections import defaultdict from contextlib import nullcontext from typing import Callable, Dict, List, Type, Union import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE, VESDE, VPSDE from mattergen.diffusion.d3pm.d3pm_predictors_correctors import D3PMAncestralSamplingPredictor fro...
IncompatibleSampler)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sde_lib.py
_check_batch_shape
assert
numeric_literal
12
from typing import Type import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor): """Checks sde outputs that should be (batch_size, )""" assert len(x.shape)...
1
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sde_lib.py
test_sde
assert
complex_expr
45
from typing import Type import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor): """Checks sde outputs that should be (batch_size, )""" assert len(x.shape) ...
x.shape
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sde_lib.py
_check_batch_shape
assert
variable
13
from typing import Type import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor): """Checks sde outputs that should be (batch_size, )""" assert len(x.shape) ...
batch_size
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/diffusion/tests/test_sde_lib.py
_check_shapes
assert
complex_expr
17
from typing import Type import pytest import torch from mattergen.diffusion.corruption.sde_lib import SDE from mattergen.diffusion.tests.conftest import SDE_TYPES def _check_batch_shape(x: torch.Tensor, batch_size: torch.LongTensor): """Checks sde outputs that should be (batch_size, )""" assert len(x.shape) ...
x.shape[0]
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_generator.py
test_chemical_system_to_multi_hot
assert
func_call
21
from typing import List import pytest from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.property_embeddings import ChemicalSystemMultiHotEmbedding @pytest.mark.parametrize("chemical_system", [["Li", "O"], ["Li", "O", "F"], ["C", "O", "H"]]) def test_chemical_system_to_multi_hot(chemical_system...
len(chemical_system)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_generator.py
test_chemical_system_to_multi_hot
assert
collection
17
from typing import List import pytest from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.property_embeddings import ChemicalSystemMultiHotEmbedding @pytest.mark.parametrize("chemical_system", [["Li", "O"], ["Li", "O", "F"], ["C", "O", "H"]]) def test_chemical_system_to_multi_hot(chemical_system...
( 1, MAX_ATOMIC_NUM + 1, )
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_mattergen_denoiser.py
test_mask_disallowed_elements
assert
func_call
90
import pytest import torch from torch_scatter import scatter_add from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate from mattergen.common.data.transform import set_chemical_system_string from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.denois...
set()
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_mattergen_denoiser.py
test_pre_corruption_fn
assert
variable
44
import pytest import torch from torch_scatter import scatter_add from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate from mattergen.common.data.transform import set_chemical_system_string from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.denois...
num_masked
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_mattergen_denoiser.py
test_pre_corruption_fn_multi
assert
variable
77
import pytest import torch from torch_scatter import scatter_add from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate from mattergen.common.data.transform import set_chemical_system_string from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.denois...
expected_number_masked
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_mattergen_denoiser.py
test_remove_conditioning_fn
assert_*
func_call
41
import pytest import torch from torch_scatter import scatter_add from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate from mattergen.common.data.transform import set_chemical_system_string from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.denois...
torch.ones((10, 1), dtype=torch.bool))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_mattergen_denoiser.py
test_keep_conditioning_fn
assert_*
func_call
36
import pytest import torch from torch_scatter import scatter_add from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate from mattergen.common.data.transform import set_chemical_system_string from mattergen.common.utils.globals import MAX_ATOMIC_NUM from mattergen.denois...
torch.zeros((10, 1), dtype=torch.bool))
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_sde_lib.py
test_expand
assert
variable
25
from abc import ABC, abstractmethod from math import pi from typing import Optional, Tuple import pytest import torch from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.diffusion.corruption import ( LatticeVPSDE, expand, make_noise_symmetric_preserve_variance, ) from mattergen.dif...
output_shape
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_sde_lib.py
test_LatticeVPSDE_prior_sampling
assert
collection
34
from abc import ABC, abstractmethod from math import pi from typing import Optional, Tuple import pytest import torch from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.diffusion.corruption import ( LatticeVPSDE, expand, make_noise_symmetric_preserve_variance, ) from mattergen.dif...
(Nbatch, 3, 3)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_sde_lib.py
test_make_noise_symmetric_preserve_variance
pytest.raises
variable
24
from abc import ABC, abstractmethod from math import pi from typing import Optional, Tuple import pytest import torch from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.diffusion.corruption import ( LatticeVPSDE, expand, make_noise_symmetric_preserve_variance, ) from mattergen.dif...
AssertionError)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/mattergen
11a321f568013bd732301d73bfc381a651ccc750
1
train
train
mattergen/tests/test_sde_lib.py
test_expand
assert
func_call
22
from abc import ABC, abstractmethod from math import pi from typing import Optional, Tuple import pytest import torch from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.diffusion.corruption import ( LatticeVPSDE, expand, make_noise_symmetric_preserve_variance, ) from mattergen.dif...
len(output_shape)
11a321f568013bd732301d73bfc381a651ccc750
1
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/backend/onnx_backend.py
_compare_results
assert_*
variable
147
import os import textwrap from typing import Iterator import numpy as np import onnx import onnx.numpy_helper from onnx.backend.test import __file__ as backend_folder from onnxscript.backend import onnx_export def assert_almost_equal_string(expected, value): """Compares two arrays knowing they contain strings. ...
o)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/rewriter/llama_rule_sets_test.py
_check_model
assert_*
variable
60
from __future__ import annotations import unittest from typing import Any import numpy as np import onnx import onnx.reference import parameterized import onnxscript import onnxscript.onnx_types as ot import onnxscript.rewriter.llama_rule_sets as llama_rule_sets from onnxscript import ir from onnxscript.onnx_opset i...
b)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/rewriter/ort_fusions/fused_matmul_rule_sets_test.py
_check_model
assert_*
variable
50
from __future__ import annotations import unittest from typing import Any import numpy as np import onnx import onnx.reference import onnx.reference.op_run import onnxscript.rewriter.ort_fusions.fused_matmul_rule_sets as fused_matmul_rule_sets from onnxscript import ir FLOAT = onnx.TensorProto.FLOAT class OrtRuleS...
b)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
tests/onnx_types_test.py
test_shapes_are_same_type
self.assertIs
variable
25
from __future__ import annotations import unittest from parameterized import parameterized from onnxscript.onnx_types import DOUBLE, FLOAT, TensorType, tensor_type_registry class TestOnnxTypes(unittest.TestCase): @parameterized.expand( [ (FLOAT, FLOAT), (FLOAT[None], FLOAT[None]...
b)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/converter_test.py
test_opset_import
self.assertIn
variable
134
import ast import inspect import os import pathlib import textwrap import types import typing import unittest import warnings import numpy as np import onnx import onnxruntime as ort import pytest from onnxruntime.capi.onnxruntime_pybind11_state import ( Fail, InvalidArgument, InvalidGraph, ) import onnxs...
s16)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/converter_test.py
test_opset_import
self.assertIn
variable
136
import ast import inspect import os import pathlib import textwrap import types import typing import unittest import warnings import numpy as np import onnx import onnxruntime as ort import pytest from onnxruntime.capi.onnxruntime_pybind11_state import ( Fail, InvalidArgument, InvalidGraph, ) import onnxs...
s14)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/rewriter/generic_pattern_test.py
test_rotary_embedding
self.assertIn
variable
152
from __future__ import annotations import contextlib import io import os import unittest import numpy as np import onnx import onnx.parser import onnx.reference import onnxruntime as ort import parameterized from onnxscript import ir from onnxscript.rewriter import generic_pattern, pattern FLOAT = onnx.TensorProto....
out)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/tools/memory_peak_test.py
test_memory
self.assertIsInstance
variable
16
import os import sys import time import unittest import numpy as np import torch import onnxscript.tools.memory_peak class TestMemoryPeak(unittest.TestCase): @unittest.skipIf(sys.platform == "win32", reason="other test are failing") def test_memory(self): mem = onnxscript.tools.memory_peak.get_memory...
int)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/values_test.py
test_it_preserves_the_function_signature
self.assertEqual
variable
29
from __future__ import annotations import inspect import typing import unittest import onnxscript from onnxscript import values class TracedOnnxFunctionTest(unittest.TestCase): def test_it_preserves_the_function_signature(self): opset = values.Opset("test", 1) def function(input1, input2, attr1...
int)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/values_test.py
test_it_preserves_the_function_signature
self.assertEqual
variable
31
from __future__ import annotations import inspect import typing import unittest import onnxscript from onnxscript import values class TracedOnnxFunctionTest(unittest.TestCase): def test_it_preserves_the_function_signature(self): opset = values.Opset("test", 1) def function(input1, input2, attr1...
str)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
tests/if_test.py
test_no_else
assert_*
variable
41
import unittest import onnxscript.testing from onnxscript import script from onnxscript.onnx_opset import opset15 as op from tests.common import testutils class IfOpTest(testutils.TestBase): def test_no_else(self): """Basic test for if-then without else.""" # TODO: pass default opset as parameter...
if2)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
tests/if_test.py
test_no_else
assert_*
variable
42
import unittest import onnxscript.testing from onnxscript import script from onnxscript.onnx_opset import opset15 as op from tests.common import testutils class IfOpTest(testutils.TestBase): def test_no_else(self): """Basic test for if-then without else.""" # TODO: pass default opset as parameter...
if3)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/backend/onnx_export_test.py
test_export2python
self.assertIn
variable
102
from __future__ import annotations import dataclasses import importlib import os import pathlib import re import sys import unittest from typing import Pattern import onnx import onnxruntime as ort import parameterized from onnxruntime.capi import onnxruntime_pybind11_state import onnxscript import onnxscript.testin...
code)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/converter_test.py
test_opset_import
self.assertIn
variable
138
import ast import inspect import os import pathlib import textwrap import types import typing import unittest import warnings import numpy as np import onnx import onnxruntime as ort import pytest from onnxruntime.capi.onnxruntime_pybind11_state import ( Fail, InvalidArgument, InvalidGraph, ) import onnxs...
sdef)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/tools/memory_peak_test.py
test_spy
self.assertIsInstance
variable
24
import os import sys import time import unittest import numpy as np import torch import onnxscript.tools.memory_peak class TestMemoryPeak(unittest.TestCase): @unittest.skipIf(sys.platform == "win32", reason="other test are failing") def test_spy(self): p = onnxscript.tools.memory_peak.start_spying_o...
dict)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/tools/memory_peak_test.py
test_spy_cuda
self.assertIsInstance
variable
25
import os import sys import time import unittest import numpy as np import torch import onnxscript.tools.memory_peak class TestMemoryPeak(unittest.TestCase): @unittest.skipIf(not torch.cuda.is_available(), reason="CUDA not here") def test_spy_cuda(self): p = onnxscript.tools.memory_peak.start_spying...
list)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/tools/memory_peak_test.py
test_spy_cuda
self.assertIn
variable
30
import os import sys import time import unittest import numpy as np import torch import onnxscript.tools.memory_peak class TestMemoryPeak(unittest.TestCase): @unittest.skipIf(not torch.cuda.is_available(), reason="CUDA not here") def test_spy_cuda(self): p = onnxscript.tools.memory_peak.start_spying...
pres)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/backend/onnx_backend.py
assert_almost_equal_string
assert_*
variable
33
import os import textwrap from typing import Iterator import numpy as np import onnx import onnx.numpy_helper from onnx.backend.test import __file__ as backend_folder from onnxscript.backend import onnx_export def assert_almost_equal_string(expected, value): """Compares two arrays knowing they contain strings. ...
value)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/tensor_test.py
_check_values_and_shape
self.assertEqual
variable
12
import unittest import numpy as np from onnxscript import tensor class TestTensor(unittest.TestCase): def _check_values_and_shape(self, result, elements, shape): values = list(result.value.flatten()) self.assertEqual(values, elements) self.assertEqual(result.shape,
shape)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/values_test.py
test_init
self.assertEqual
variable
18
from __future__ import annotations import inspect import typing import unittest import onnxscript from onnxscript import values class TracedOnnxFunctionTest(unittest.TestCase): def test_init(self): def function(input1, input2, attr1: int, attr2: int = 1): return input1 + input2 + attr1 + attr...
opset)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
onnxscript/values_test.py
test_it_preserves_the_function_signature
self.assertEqual
variable
30
from __future__ import annotations import inspect import typing import unittest import onnxscript from onnxscript import values class TracedOnnxFunctionTest(unittest.TestCase): def test_it_preserves_the_function_signature(self): opset = values.Opset("test", 1) def function(input1, input2, attr1...
float)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor
microsoft/onnxscript
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
train
train
tests/ir/serde_roundtrip_test.py
test_serialization_deserialization_produces_same_model
assert_*
variable
38
from __future__ import annotations import pathlib import unittest import onnx import onnx.backend.test import parameterized import onnxscript.testing from onnxscript import ir model_folder_path = pathlib.Path(__file__).resolve().parent.parent.parent / "testdata" onnx_backend_test_path = pathlib.Path(onnx.backend.te...
model)
f5327f8849e3ce2a5c7c674b7dc62d67c0111ace
621
v2_extractor_at_anchor