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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/collision/test_signed_distance_field.py | test_signed_distance_2d_jacobian | assert | numeric_literal | 33 | import pytest # noqa
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.utils import numeric_jacobian
from .utils import random_sdf
def test_signed_distance_2d_jacobian():
for batch_size in BATCH_SIZES_TO_TEST:
sdf = random_sdf(batch_size, 10, 10)
fo... | 1e-5 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/collision/test_signed_distance_field.py | test_to | pytest.raises | variable | 16 | import pytest # noqa
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.utils import numeric_jacobian
from .utils import random_sdf
def test_to():
if not torch.cuda.is_available():
return
sdf = random_sdf(1, 10, 10)
points = torch.randn(1, 2, 100).to... | RuntimeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/collision/test_signed_distance_field.py | test_sdf_2d_shapes | assert | collection | 21 | import pytest # noqa
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.utils import numeric_jacobian
from .utils import random_sdf
def test_sdf_2d_shapes():
generator = torch.Generator()
generator.manual_seed(0)
for batch_size in BATCH_SIZES_TO_TEST:
... | (batch_size, num_points) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/collision/test_signed_distance_field.py | test_sdf_2d_shapes | assert | collection | 22 | import pytest # noqa
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.utils import numeric_jacobian
from .utils import random_sdf
def test_sdf_2d_shapes():
generator = torch.Generator()
generator.manual_seed(0)
for batch_size in BATCH_SIZES_TO_TEST:
... | (batch_size, num_points, 2) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/measurements/test_between.py | test_copy_between | assert | string_literal | 53 | import numpy as np
import torch
import theseus as th
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
check_another_theseus_tensor_is_copy,
)
from theseus.utils import numeric_jacobian
def evaluate_numerical_jacobian_between(Group, tol):
rng = torch.Generato... | "new_name" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/measurements/test_moving_frame_between.py | test_copy_moving_frame_between | assert | string_literal | 39 | import numpy as np
import torch
import theseus.core as thcore
import theseus.embodied as thembod
import theseus.geometry as thgeom
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
check_another_theseus_tensor_is_copy,
)
from tests.geometry.test_se2 import create_... | "new_name" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/measurements/test_reprojection.py | test_residual | assert | numeric_literal | 89 | import torch
import theseus as th
from theseus.utils.examples.bundle_adjustment.util import random_small_quaternion
def test_residual():
# unit test for Cost term
torch.manual_seed(0)
batch_size = 4
cam_rot = torch.cat(
[
random_small_quaternion(max_degrees=20).unsqueeze(0)
... | 5e-5 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/misc/test_variable_difference.py | test_copy_local_cost_fn | assert | string_literal | 47 | import numpy as np
import torch
import theseus as th
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
check_another_theseus_tensor_is_copy,
)
from theseus.utils import numeric_jacobian
def evaluate_numerical_jacobian_local_cost_fn(Group, tol):
rng = torch.Ge... | "new_name" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_double_integrator.py | test_gp_motion_model_variable_type | assert | numeric_literal | 41 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.core import Variable
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
)
from theseus.utils import numeric_jacobian
def test_gp_motion_model_variable_type():
... | 2 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_double_integrator.py | test_gp_motion_model_variable_type | assert | variable | 34 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.core import Variable
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
)
from theseus.utils import numeric_jacobian
def test_gp_motion_model_variable_type():
... | dt_v | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_double_integrator.py | test_gp_motion_model_variable_type | assert | variable | 33 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.core import Variable
from tests.core.common import (
BATCH_SIZES_TO_TEST,
check_another_theseus_function_is_copy,
)
from theseus.utils import numeric_jacobian
def test_gp_motion_model_variable_type():
... | q_inv_v | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_misc.py | test_hinge_loss | assert | variable | 43 | import theseus as th
import torch
from theseus.utils import check_jacobians
def test_hinge_loss():
rng = torch.Generator()
rng.manual_seed(0)
batch_size = 10
how_many = 4
def _rand_chunk():
return torch.rand(batch_size, how_many, generator=rng)
for limit in [0.0, 1.0]:
thresh... | nn_zero | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_misc.py | test_hinge_loss | assert | complex_expr | 42 | import theseus as th
import torch
from theseus.utils import check_jacobians
def test_hinge_loss():
rng = torch.Generator()
rng.manual_seed(0)
batch_size = 10
how_many = 4
def _rand_chunk():
return torch.rand(batch_size, how_many, generator=rng)
for limit in [0.0, 1.0]:
thresh... | -nn_zero | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_misc.py | test_hinge_loss | assert | complex_expr | 41 | import theseus as th
import torch
from theseus.utils import check_jacobians
def test_hinge_loss():
rng = torch.Generator()
rng.manual_seed(0)
batch_size = 10
how_many = 4
def _rand_chunk():
return torch.rand(batch_size, how_many, generator=rng)
for limit in [0.0, 1.0]:
thresh... | 2 * nn_zero | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_misc.py | test_hinge_loss | assert | collection | 34 | import theseus as th
import torch
from theseus.utils import check_jacobians
def test_hinge_loss():
rng = torch.Generator()
rng.manual_seed(0)
batch_size = 10
how_many = 4
def _rand_chunk():
return torch.rand(batch_size, how_many, generator=rng)
for limit in [0.0, 1.0]:
thresh... | (batch_size, 3 * how_many) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_misc.py | test_hinge_loss | assert | collection | 33 | import theseus as th
import torch
from theseus.utils import check_jacobians
def test_hinge_loss():
rng = torch.Generator()
rng.manual_seed(0)
batch_size = 10
how_many = 4
def _rand_chunk():
return torch.rand(batch_size, how_many, generator=rng)
for limit in [0.0, 1.0]:
thresh... | (batch_size, 3 * how_many, 3 * how_many) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/embodied/motionmodel/test_quasi_static_pushing_planar.py | _check_jacobian | assert | numeric_literal | 13 | import numpy as np
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from tests.geometry.test_se2 import create_random_se2
from theseus.utils import numeric_jacobian
def _check_jacobian(actual_, expected_):
# This makes failures more explicit than torch.al... | 1e-5 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/extlib/test_baspacho.py | check_baspacho | assert | numeric_literal | 24 | import numpy as np
import pytest # noqa: F401
import torch # needed for import of Torch C++ extensions to work
from scipy.sparse import csr_matrix, tril
from tests.decorators import run_if_baspacho
from theseus.utils import random_sparse_matrix, split_into_param_sizes
def check_baspacho(
batch_size,
rows_to... | 1.0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/extlib/test_cusolver_lu_solver.py | check_lu_solver | assert | variable | 13 | import numpy as np
import pytest # noqa: F401
import torch # needed for import of Torch C++ extensions to work
from scipy.sparse import csr_matrix
from theseus.utils import random_sparse_matrix
def check_lu_solver(
init_batch_size, batch_size, num_rows, num_cols, fill, verbose=False
):
# this is necessary a... | num_cols | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_point_types.py | test_operations_mypy_cast | assert | numeric_literal | 36 | import warnings
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from .common import (
BATCH_SIZES_TO_TEST,
check_jacobian_for_local,
check_projection_for_exp_map,
check_projection_for_log_map,
)
def test_operations_mypy_cast():
# mypy is optional i... | 0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_se2.py | test_transform_from_and_to | assert | complex_expr | 77 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import TEST_EPS
from tests.core.common import check_copy_var
from theseus.utils import numeric_jacobian
from .common import (
BATCH_SIZES_TO_TEST,
check_adjoint,
check_compose,
check_exp_map,
ch... | expected_jac[0].shape | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_se2.py | test_transform_from_and_to | assert | complex_expr | 78 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import TEST_EPS
from tests.core.common import check_copy_var
from theseus.utils import numeric_jacobian
from .common import (
BATCH_SIZES_TO_TEST,
check_adjoint,
check_compose,
check_exp_map,
ch... | expected_jac[1].shape | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_so2.py | test_rotate_and_unrotate | assert | complex_expr | 64 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from theseus.utils import numeric_jacobian
from .common import (
BATCH_SIZES_TO_TEST,
check_adjoint,
check_compose,
check_exp_map,
check_i... | expected_jac[0].shape | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_so2.py | test_rotate_and_unrotate | assert | complex_expr | 65 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from theseus.utils import numeric_jacobian
from .common import (
BATCH_SIZES_TO_TEST,
check_adjoint,
check_compose,
check_exp_map,
check_i... | expected_jac[1].shape | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_vector.py | test_matmul | assert | collection | 28 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from .common import (
BATCH_SIZES_TO_TEST,
check_jacobian_for_local,
check_projection_for_exp_map,
check_projection_for_log_map,
)
torch.manu... | (i, k) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_vector.py | test_matmul | assert | collection | 33 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from .common import (
BATCH_SIZES_TO_TEST,
check_jacobian_for_local,
check_projection_for_exp_map,
check_projection_for_log_map,
)
torch.manu... | (i, j) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_vector.py | test_norm | assert | func_call | 24 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from .common import (
BATCH_SIZES_TO_TEST,
check_jacobian_for_local,
check_projection_for_exp_map,
check_projection_for_log_map,
)
torch.manu... | t1.norm() | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/geometry/test_vector.py | test_norm | assert | func_call | 25 | import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from tests.core.common import check_copy_var
from .common import (
BATCH_SIZES_TO_TEST,
check_jacobian_for_local,
check_projection_for_exp_map,
check_projection_for_log_map,
)
torch.manu... | torch.norm(t1, p="fro") | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/functional/common.py | check_lie_group_function | assert_* | variable | 90 | import torch
BATCH_SIZES_TO_TEST = [1, 20]
TEST_EPS = 5e-7
def get_test_cfg(op_name, dtype, dim, data_shape, module=None):
atol = TEST_EPS
# input_type --> tuple[str, param]
# input_types --> a tuple of type info for a given function
# all_input_types --> a list of input types, if more than one check ... | jac) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/functional/common.py | check_lie_group_function | assert_* | func_call | 96 | import torch
BATCH_SIZES_TO_TEST = [1, 20]
TEST_EPS = 5e-7
def get_test_cfg(op_name, dtype, dim, data_shape, module=None):
atol = TEST_EPS
# input_type --> tuple[str, param]
# input_types --> a tuple of type info for a given function
# all_input_types --> a list of input types, if more than one check ... | func(jac)) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/functional/test_se3.py | test_vee | assert_* | variable | 25 | import pytest
import torch
from tests.decorators import run_if_labs
from .common import BATCH_SIZES_TO_TEST, TEST_EPS, check_lie_group_function, run_test_op
@run_if_labs()
@pytest.mark.parametrize("batch_size", BATCH_SIZES_TO_TEST)
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_vee(batch_... | tangent_vector) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/functional/test_so3.py | test_vee | assert_* | variable | 25 | import pytest
import torch
from tests.decorators import run_if_labs
from .common import BATCH_SIZES_TO_TEST, TEST_EPS, check_lie_group_function, run_test_op
@run_if_labs()
@pytest.mark.parametrize("batch_size", BATCH_SIZES_TO_TEST)
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
def test_vee(batch_... | tangent_vector) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/test_lie_tensor.py | test_op | assert_* | variable | 106 | import pytest
import torch
from tests.decorators import run_if_labs
from .functional.common import get_test_cfg, sample_inputs
def rng():
rng_ = torch.Generator()
rng_.manual_seed(0)
return rng_
def _get_lie_tensor_inputs(input_types, sampled_inputs, ltype):
import theseus.labs.lie as lie
def _g... | out_c) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/test_lie_tensor.py | test_op | assert_* | variable | 84 | import pytest
import torch
from tests.decorators import run_if_labs
from .functional.common import get_test_cfg, sample_inputs
def rng():
rng_ = torch.Generator()
rng_.manual_seed(0)
return rng_
def _get_lie_tensor_inputs(input_types, sampled_inputs, ltype):
import theseus.labs.lie as lie
def _g... | impl_out) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/test_lie_tensor.py | test_op | assert_* | collection | 119 | import pytest
import torch
from tests.decorators import run_if_labs
from .functional.common import get_test_cfg, sample_inputs
def rng():
rng_ = torch.Generator()
rng_.manual_seed(0)
return rng_
def _get_lie_tensor_inputs(input_types, sampled_inputs, ltype):
import theseus.labs.lie as lie
def _g... | [jac_c, out_c]) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/labs/lie/test_lie_tensor.py | test_op | assert_* | collection | 114 | import pytest
import torch
from tests.decorators import run_if_labs
from .functional.common import get_test_cfg, sample_inputs
def rng():
rng_ = torch.Generator()
rng_.manual_seed(0)
return rng_
def _get_lie_tensor_inputs(input_types, sampled_inputs, ltype):
import theseus.labs.lie as lie
def _g... | [impl_jac, impl_out]) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/autograd/common.py | check_grad | assert_* | func_call | 29 | import torch
from torch.autograd import grad, gradcheck
def check_grad(solve_func, inputs, eps, atol, rtol):
assert gradcheck(solve_func, inputs, eps=eps, atol=atol)
A_val, b = inputs[0], inputs[1]
# Check that the gradient works correctly for floating point data
out = solve_func(*inputs).sum()
gA... | gA_float.double()) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/autograd/common.py | check_grad | assert_* | func_call | 30 | import torch
from torch.autograd import grad, gradcheck
def check_grad(solve_func, inputs, eps, atol, rtol):
assert gradcheck(solve_func, inputs, eps=eps, atol=atol)
A_val, b = inputs[0], inputs[1]
# Check that the gradient works correctly for floating point data
out = solve_func(*inputs).sum()
gA... | gb_float.double()) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/autograd/test_baspacho_sparse_backward.py | get_linearization_and_solver_for_random_sparse | assert | numeric_literal | 18 | import pytest # noqa: F401
import torch
import numpy as np
from theseus.optimizer.autograd import BaspachoSolveFunction
from tests.decorators import run_if_baspacho
from theseus.utils import random_sparse_binary_matrix, split_into_param_sizes
import theseus as th
from .common import check_grad
def get_linearization... | 1.0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/autograd/test_sparse_backward.py | test_float64_used | assert | numeric_literal | 35 | import pytest # noqa: F401
import torch
from sksparse.cholmod import analyze_AAt
from torch.autograd import gradcheck
import theseus as th
from theseus.optimizer.autograd import CholmodSolveFunction
def _build_sparse_mat(batch_size):
torch.manual_seed(37)
all_cols = list(range(10))
col_ind = []
row_p... | 1.0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_baspacho_sparse_solver.py | check_sparse_solver | assert_* | variable | 35 | import pytest # noqa: F401
import torch
from tests.decorators import run_if_baspacho
from tests.optimizer.autograd.test_baspacho_sparse_backward import (
get_linearization_and_solver_for_random_sparse,
)
def check_sparse_solver(
batch_size, rows_to_cols_ratio, num_cols, param_size_range, fill, dev="cpu"
):
... | atb_check) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_cholmod_sparse_solver.py | _check_correctness | assert | numeric_literal | 24 | import pytest # noqa: F401
import torch
from sksparse.cholmod import analyze_AAt
import theseus as th
def _build_sparse_mat(batch_size):
all_cols = list(range(10))
col_ind = []
row_ptr = [0]
for i in range(12):
start = max(0, i - 2)
end = min(i + 1, 10)
col_ind += all_cols[sta... | 1e-4 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_dense_solver.py | test_handle_singular | assert | numeric_literal | 40 | import pytest # noqa: F401
import torch
import theseus as th
def _create_linear_system(batch_size=32, matrix_size=10):
A = torch.randn((batch_size, matrix_size, matrix_size))
AtA = torch.empty((batch_size, matrix_size, matrix_size))
Atb = torch.empty((batch_size, matrix_size, 1))
x = torch.randn((bat... | 0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_dense_solver.py | test_dense_solvers | assert | numeric_literal | 32 | import pytest # noqa: F401
import torch
import theseus as th
def _create_linear_system(batch_size=32, matrix_size=10):
A = torch.randn((batch_size, matrix_size, matrix_size))
AtA = torch.empty((batch_size, matrix_size, matrix_size))
Atb = torch.empty((batch_size, matrix_size, 1))
x = torch.randn((bat... | 1e-4 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_dense_solver.py | test_handle_singular | assert | numeric_literal | 39 | import pytest # noqa: F401
import torch
import theseus as th
def _create_linear_system(batch_size=32, matrix_size=10):
A = torch.randn((batch_size, matrix_size, matrix_size))
AtA = torch.empty((batch_size, matrix_size, matrix_size))
Atb = torch.empty((batch_size, matrix_size, 1))
x = torch.randn((bat... | 1e-6 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_lu_cuda_sparse_solver.py | test_sparse_solver | assert_* | variable | 67 | import pytest # noqa: F401
import torch
import theseus as th
def _build_sparse_mat(batch_size, rng):
all_cols = list(range(10))
col_ind = []
row_ptr = [0]
for i in range(12):
start = max(0, i - 2)
end = min(i + 1, 10)
col_ind += all_cols[start:end]
row_ptr.append(len(c... | atb_check) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_lu_cuda_sparse_solver.py | check_sparse_solver_multistep | pytest.raises | variable | 83 | import pytest # noqa: F401
import torch
import theseus as th
def _build_sparse_mat(batch_size, rng):
all_cols = list(range(10))
col_ind = []
row_ptr = [0]
for i in range(12):
start = max(0, i - 2)
end = min(i + 1, 10)
col_ind += all_cols[start:end]
row_ptr.append(len(c... | RuntimeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/linear/test_lu_cuda_sparse_solver.py | check_sparse_solver_multistep | assert_* | variable | 115 | import pytest # noqa: F401
import torch
import theseus as th
def _build_sparse_mat(batch_size, rng):
all_cols = list(range(10))
col_ind = []
row_ptr = [0]
for i in range(12):
start = max(0, i - 2)
end = min(i + 1, 10)
col_ind += all_cols[start:end]
row_ptr.append(len(c... | analytic_der) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/common.py | callback | assert | variable | 16 | import pytest # noqa: F401
import torch
import theseus as th
def _check_info(info, batch_size, max_iterations, initial_error, objective):
assert info.err_history.shape == (batch_size, max_iterations + 1)
assert info.err_history[:, 0].allclose(initial_error)
assert info.err_history.argmin(dim=1).allclose(... | optimizer | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/common.py | _check_optimizer_returns_fail_status_on_singular | pytest.raises | variable | 165 | import pytest # noqa: F401
import torch
import theseus as th
def _check_info(info, batch_size, max_iterations, initial_error, objective):
assert info.err_history.shape == (batch_size, max_iterations + 1)
assert info.err_history[:, 0].allclose(initial_error)
assert info.err_history.argmin(dim=1).allclose(... | RuntimeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/common.py | callback | assert | complex_expr | 19 | import pytest # noqa: F401
import torch
import theseus as th
def _check_info(info, batch_size, max_iterations, initial_error, objective):
assert info.err_history.shape == (batch_size, max_iterations + 1)
assert info.err_history[:, 0].allclose(initial_error)
assert info.err_history.argmin(dim=1).allclose(... | callback_expected_iter[0] | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/common.py | _check_info | assert | collection | 8 | import pytest # noqa: F401
import torch
import theseus as th
def _check_info(info, batch_size, max_iterations, initial_error, objective):
assert info.err_history.shape == | (batch_size, max_iterations + 1) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_backwards.py | test_backwards_quartic | assert | numeric_literal | 81 | import pytest
import torch
import theseus as th
from tests.decorators import run_if_baspacho
from theseus.utils import numeric_grad
torch.manual_seed(0)
@run_if_baspacho()
@pytest.mark.parametrize(
"linear_solver_cls",
[
th.CholeskyDenseSolver,
th.CholmodSparseSolver,
th.LUCudaSparse... | 1.5 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_backwards.py | test_backwards_quad_fit | assert_* | variable | 138 | import pytest
import torch
import theseus as th
from tests.decorators import run_if_baspacho
from theseus.utils import numeric_grad
torch.manual_seed(0)
@pytest.mark.parametrize(
"linear_solver_cls", [th.CholeskyDenseSolver, th.CholmodSparseSolver]
)
def test_backwards_quad_fit(linear_solver_cls):
def gener... | da_dx_dlm) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_backwards.py | test_backwards_quad_fit | assert_* | variable | 97 | import pytest
import torch
import theseus as th
from tests.decorators import run_if_baspacho
from theseus.utils import numeric_grad
torch.manual_seed(0)
@pytest.mark.parametrize(
"linear_solver_cls", [th.CholeskyDenseSolver, th.CholmodSparseSolver]
)
def test_backwards_quad_fit(linear_solver_cls):
def gener... | da_dx_unroll) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_backwards.py | test_backwards_quad_fit | assert_* | variable | 110 | import pytest
import torch
import theseus as th
from tests.decorators import run_if_baspacho
from theseus.utils import numeric_grad
torch.manual_seed(0)
@pytest.mark.parametrize(
"linear_solver_cls", [th.CholeskyDenseSolver, th.CholmodSparseSolver]
)
def test_backwards_quad_fit(linear_solver_cls):
def gener... | da_dx_implicit) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_backwards.py | test_backwards_quad_fit | assert_* | variable | 124 | import pytest
import torch
import theseus as th
from tests.decorators import run_if_baspacho
from theseus.utils import numeric_grad
torch.manual_seed(0)
@pytest.mark.parametrize(
"linear_solver_cls", [th.CholeskyDenseSolver, th.CholmodSparseSolver]
)
def test_backwards_quad_fit(linear_solver_cls):
def gener... | da_dx_truncated) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_levenberg_marquardt.py | test_ellipsoidal_damping_compatibility | pytest.raises | variable | 28 | import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.optimizer.nonlinear.common import run_nonlinear_least_squares_check
def mock_objective():
objective = th.Objective()
v1 = th.Vector(1, name="v1")
v2 = th.Vector(1, name="v2"... | RuntimeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_state_history.py | test_state_history | assert | complex_expr | 28 | import pytest # noqa: F401
import theseus as th
@pytest.mark.parametrize(
"var_type", [(th.Vector, 1), (th.Vector, 2), (th.SE2, None), (th.SE3, None)]
)
@pytest.mark.parametrize("batch_size", [1, 10])
def test_state_history(var_type, batch_size):
cls_, dof = var_type
rand_args = (batch_size, dof) if cls... | info.state_history | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_state_history.py | test_state_history | assert | collection | 29 | import pytest # noqa: F401
import theseus as th
@pytest.mark.parametrize(
"var_type", [(th.Vector, 1), (th.Vector, 2), (th.SE2, None), (th.SE3, None)]
)
@pytest.mark.parametrize("batch_size", [1, 10])
def test_state_history(var_type, batch_size):
cls_, dof = var_type
rand_args = (batch_size, dof) if cls... | (objective.batch_size,) + tuple( var.shape[1:] ) + (max_iters + 1,) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/nonlinear/test_trust_region.py | test_rho | assert_* | func_call | 56 | import pytest
import theseus as th
import torch
@pytest.mark.parametrize("dof", [1, 8])
@pytest.mark.parametrize(
"linear_solver_cls",
[th.CholeskyDenseSolver, th.CholmodSparseSolver, th.LUCudaSparseSolver],
)
def test_rho(dof, linear_solver_cls):
device = "cuda:0" if torch.cuda.is_available() else "cpu"
... | torch.ones_like(rho)) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_init | assert | variable | 49 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | dof | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_to | assert | variable | 41 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | dtype | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_copy | assert | string_literal | 45 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | "new" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_init | assert | complex_expr | 46 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | t.name | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_init | assert | complex_expr | 51 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | mean[j] | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_copy | assert | variable | 40 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | new_var | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_update | pytest.raises | variable | 56 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | ValueError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_init | assert | func_call | 62 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | len(all_ids) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_copy | assert | complex_expr | 42 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | new_var.mean[j] | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_copy | assert | complex_expr | 43 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | new_var.precision | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_copy | assert | string_literal | 47 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | f"{var.name}_copy" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_manifold_gaussian.py | test_init | assert | string_literal | 48 | import copy
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
def random_manifold_gaussian_params():
manif_types = [th.Point2, th.Point3, th.SE2, th.SE3, th.SO2, th.SO3]
n_vars = np.random.randint(1, 5)
batch_size = np.random.randint(1, 100)
mean = []
dof = 0
f... | f"ManifoldGaussian__{t._id}" | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_sparse_linearization.py | test_sparse_linearization | assert_* | variable | 39 | import pytest # noqa: F401
import torch # noqa: F401
import theseus as th
from tests.optimizer.linearization_test_utils import (
build_test_objective_and_linear_system,
)
def test_sparse_linearization():
objective, ordering, A, b = build_test_objective_and_linear_system()
linearization = th.SparseLinea... | av) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_sparse_linearization.py | test_sparse_linearization | assert_* | variable | 30 | import pytest # noqa: F401
import torch # noqa: F401
import theseus as th
from tests.optimizer.linearization_test_utils import (
build_test_objective_and_linear_system,
)
def test_sparse_linearization():
objective, ordering, A, b = build_test_objective_and_linear_system()
linearization = th.SparseLinea... | atb_out) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_sparse_linearization.py | test_sparse_linearization | assert_* | variable | 44 | import pytest # noqa: F401
import torch # noqa: F401
import theseus as th
from tests.optimizer.linearization_test_utils import (
build_test_objective_and_linear_system,
)
def test_sparse_linearization():
objective, ordering, A, b = build_test_objective_and_linear_system()
linearization = th.SparseLinea... | scaled_v) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_sparse_linearization.py | test_sparse_linearization | assert_* | complex_expr | 25 | import pytest # noqa: F401
import torch # noqa: F401
import theseus as th
from tests.optimizer.linearization_test_utils import (
build_test_objective_and_linear_system,
)
def test_sparse_linearization():
objective, ordering, A, b = build_test_objective_and_linear_system()
linearization = th.SparseLinea... | linearization.b[i]) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_sparse_linearization.py | test_sparse_linearization | assert_* | func_call | 22 | import pytest # noqa: F401
import torch # noqa: F401
import theseus as th
from tests.optimizer.linearization_test_utils import (
build_test_objective_and_linear_system,
)
def test_sparse_linearization():
objective, ordering, A, b = build_test_objective_and_linear_system()
linearization = th.SparseLinea... | torch.Tensor(csrAi.todense())) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_variable_ordering_append_and_remove | assert | complex_expr | 23 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_variable_ordering_append_and_remove():
variables = [MockVar(1, tensor=None, name=f"var{i}") for i in range(50)]
mock_objective = th.Obj... | order[i] | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_variable_ordering_iterator | assert | complex_expr | 21 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_variable_ordering_iterator():
variables = [MockVar(1, tensor=None, name=f"var{i}") for i in range(50)]
mock_objective = th.Objective()
... | variables[i] | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_variable_ordering_append_and_remove | assert | complex_expr | 30 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_variable_ordering_append_and_remove():
variables = [MockVar(1, tensor=None, name=f"var{i}") for i in range(50)]
mock_objective = th.Obj... | order._var_order | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_variable_ordering_append_and_remove | assert | func_call | 22 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_variable_ordering_append_and_remove():
variables = [MockVar(1, tensor=None, name=f"var{i}") for i in range(50)]
mock_objective = th.Obj... | order.index_of(v.name) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_variable_ordering_append_and_remove | assert | complex_expr | 31 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_variable_ordering_append_and_remove():
variables = [MockVar(1, tensor=None, name=f"var{i}") for i in range(50)]
mock_objective = th.Obj... | order._var_name_to_index | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/optimizer/test_variable_ordering.py | test_default_variable_ordering | assert | func_call | 40 | import itertools
import random
import pytest # noqa: F401
import torch
import theseus as th
from tests.core.common import MockCostFunction, MockCostWeight, MockVar
def test_default_variable_ordering():
# repeat test a few times with different inputs
for _ in range(5):
# vary the number of variables ... | default_order.index_of(var.name) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_dlm_perturbation.py | test_backward_pass_se3_runs | assert | variable | 51 | import numpy as np
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.theseus_layer import _DLMPerturbation
from theseus.utils import numeric_jacobian
def _original_dlm_perturbation(optim_vars, aux_vars):
v = optim_vars[0]
g = aux_vars[0]
epsilon = aux_vars[1]... | loss0 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_dlm_perturbation.py | test_dlm_perturbation_jacobian | assert_* | variable | 65 | import numpy as np
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.theseus_layer import _DLMPerturbation
from theseus.utils import numeric_jacobian
def _original_dlm_perturbation(optim_vars, aux_vars):
v = optim_vars[0]
g = aux_vars[0]
epsilon = aux_vars[1]... | original_err) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_dlm_perturbation.py | test_dlm_perturbation_jacobian | assert_* | complex_expr | 66 | import numpy as np
import torch
import theseus as th
from tests.core.common import BATCH_SIZES_TO_TEST
from theseus.theseus_layer import _DLMPerturbation
from theseus.utils import numeric_jacobian
def _original_dlm_perturbation(optim_vars, aux_vars):
v = optim_vars[0]
g = aux_vars[0]
epsilon = aux_vars[1]... | original_jac[0]) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_pgo_benchmark.py | test_pgo_losses | pytest.approx | complex_expr | 53 | import pytest
import torch
from omegaconf import OmegaConf
import examples.pose_graph.pose_graph_synthetic as pgo
from tests.decorators import run_if_baspacho
def default_cfg():
cfg = OmegaConf.load("examples/configs/pose_graph/pose_graph_synthetic.yaml")
cfg.outer_optim.num_epochs = 1
cfg.outer_optim.ma... | expected_loss, rel=1e-10, abs=1e-10) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_pgo_benchmark.py | test_pgo_losses | assert | func_call | 53 | import pytest
import torch
from omegaconf import OmegaConf
import examples.pose_graph.pose_graph_synthetic as pgo
from tests.decorators import run_if_baspacho
def default_cfg():
cfg = OmegaConf.load("examples/configs/pose_graph/pose_graph_synthetic.yaml")
cfg.outer_optim.num_epochs = 1
cfg.outer_optim.ma... | pytest.approx(expected_loss, rel=1e-10, abs=1e-10) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_theseus_layer.py | test_pass_optimizer_kwargs | assert | none_literal | 369 | import math
from unittest import mock
import pytest # noqa: F401
import torch
import torch.nn as nn
import torch.nn.functional as F
import theseus as th
import theseus.utils as thutils
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.core.common import (
MockCostFunction,
MockCostWeight,... | None | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_theseus_layer.py | test_no_layer_kwargs | pytest.raises | variable | 363 | import math
from unittest import mock
import pytest # noqa: F401
import torch
import torch.nn as nn
import torch.nn.functional as F
import theseus as th
import theseus.utils as thutils
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.core.common import (
MockCostFunction,
MockCostWeight,... | TypeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_theseus_layer.py | test_pass_optimizer_kwargs | pytest.raises | variable | 372 | import math
from unittest import mock
import pytest # noqa: F401
import torch
import torch.nn as nn
import torch.nn.functional as F
import theseus as th
import theseus.utils as thutils
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.core.common import (
MockCostFunction,
MockCostWeight,... | ValueError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_theseus_layer.py | test_send_to_device | pytest.raises | variable | 358 | import math
from unittest import mock
import pytest # noqa: F401
import torch
import torch.nn as nn
import torch.nn.functional as F
import theseus as th
import theseus.utils as thutils
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.core.common import (
MockCostFunction,
MockCostWeight,... | RuntimeError) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/test_theseus_layer.py | test_send_to_device | assert | complex_expr | 363 | import math
from unittest import mock
import pytest # noqa: F401
import torch
import torch.nn as nn
import torch.nn.functional as F
import theseus as th
import theseus.utils as thutils
from theseus.constants import __FROM_THESEUS_LAYER_TOKEN__
from tests.core.common import (
MockCostFunction,
MockCostWeight,... | input_values[k].device | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/utils/test_utils.py | _check_sparse_mv_and_mtv | assert | numeric_literal | 51 | import numpy as np
import pytest # noqa: F401
import scipy.sparse
import torch
import torch.nn as nn
import theseus as th
import theseus.utils as thutils
def _check_sparse_mv_and_mtv(batch_size, num_rows, num_cols, fill, device):
A_col_ind, A_row_ptr, A_val, _ = thutils.random_sparse_matrix(
batch_size,
... | 1e-8 | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/utils/test_utils.py | test_build_mlp | assert | variable | 35 | import numpy as np
import pytest # noqa: F401
import scipy.sparse
import torch
import torch.nn as nn
import theseus as th
import theseus.utils as thutils
def test_build_mlp():
# set seed for mlp
torch.manual_seed(0)
# create name to class map for activation function
act_name_to_cls_map = {"relu": nn.... | hidden_depth | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
facebookresearch/theseus | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | train | train | tests/utils/test_utils.py | test_gather_from_rows_cols | assert | collection | 24 | import numpy as np
import pytest # noqa: F401
import scipy.sparse
import torch
import torch.nn as nn
import theseus as th
import theseus.utils as thutils
def test_gather_from_rows_cols():
rng = np.random.default_rng(0)
generator = torch.Generator()
generator.manual_seed(0)
for _ in range(100):
... | (batch_size, num_points) | f2509ce58e301464b4b090c10fb4b118e83d2db0 | 126 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_generate.py | test_should_generate_from_custom_generator | assert | numeric_literal | 17 | import os
from fastapi_mvc.cli.generate import get_generate_cmd
class TestCliGenerateCommand:
def test_should_generate_from_custom_generator(self, cli_runner, monkeypatch, default_project):
# given
monkeypatch.chdir(default_project)
# when
result = cli_runner.invoke(get_generate_... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_new.py | test_should_generate_new_project_with_default_structure | assert | numeric_literal | 18 | import os
from copier.user_data import load_answersfile_data
from tests.integration.conftest import assert_paths
from fastapi_mvc import ANSWERS_FILE
class TestCliNewCommand:
def test_should_generate_new_project_with_default_structure(self, new_copy, cli_runner):
with cli_runner.isolated_filesystem() as ... | 0 | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
fastapi-mvc/fastapi-mvc | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | train | train | tests/integration/cli/test_new.py | test_should_generate_using_overriden_template | assert | string_literal | 29 | import os
from copier.user_data import load_answersfile_data
from tests.integration.conftest import assert_paths
from fastapi_mvc import ANSWERS_FILE
class TestCliNewCommand:
def test_should_generate_using_overriden_template(self, new_copy, cli_runner):
with cli_runner.isolated_filesystem() as tmp:
... | "82234c2" | 632863cf91d0bea083885adef4865cb57fa1d60f | 33 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.