Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of warnings in the current test CI on develop #163

Open
gomezzz opened this issue Mar 6, 2023 · 1 comment
Open

A lot of warnings in the current test CI on develop #163

gomezzz opened this issue Mar 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@gomezzz
Copy link
Collaborator

gomezzz commented Mar 6, 2023

Issue

Problem Description

Currently tests throw a lot of warnings on develop branch

 =============================== warnings summary ===============================
torchquad/tests/boole_test.py: 4 warnings
torchquad/tests/gradient_test.py: 3 warnings
torchquad/tests/integrator_types_test.py: 4 warnings
torchquad/tests/monte_carlo_test.py: 4 warnings
torchquad/tests/simpson_test.py: 7 warnings
torchquad/tests/trapezoid_test.py: 4 warnings
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/utils.py:255: UserWarning: DEPRECATION WARNING: In future versions of torchquad, an array-like object will be returned.
    warnings.warn(

torchquad/tests/boole_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /home/conda/feedstock_root/build_artifacts/pytorch-recipe_1675740247391/work/aten/src/ATen/native/TensorShape.cpp:3190.)
    return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]

torchquad/tests/monte_carlo_test.py::test_integrate_jax
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/autoray/autoray.py:79: UserWarning: Explicitly requested dtype <class 'jax.numpy.float64'> requested in array is not available, and will be truncated to dtype float32. To enable more dtypes, set the jax_enable_x64 configuration option or the JAX_ENABLE_X64 shell environment variable. See https://github.com/google/jax#current-gotchas for more.
    return get_lib_fn(backend, fn)(*args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================== 48 passed, 28 warnings in 84.06s (0:01:24) ==================

Expected Behavior

Not or few warnings.

What Needs to be Done

Fix warnings ✌️

How Can It Be Tested or Reproduced

Running tests with environment for all backends or on github.

@gomezzz gomezzz added the bug Something isn't working label Mar 6, 2023
@gomezzz gomezzz changed the title A lot of warnings in the current test CI A lot of warnings in the current test CI on develop Mar 6, 2023
@gomezzz gomezzz mentioned this issue Mar 6, 2023
1 task
@gomezzz
Copy link
Collaborator Author

gomezzz commented Jun 3, 2023

It has become even more, now > 100 warnings in CI. 😨


=============================== warnings summary ===============================
torchquad/tests/boole_test.py: 6 warnings
torchquad/tests/gauss_test.py: 4 warnings
torchquad/tests/gradient_test.py: 3 warnings
torchquad/tests/integrator_types_test.py: 4 warnings
torchquad/tests/monte_carlo_test.py: 4 warnings
torchquad/tests/simpson_test.py: 7 warnings
torchquad/tests/trapezoid_test.py: 4 warnings
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/utils.py:255: UserWarning: DEPRECATION WARNING: In future versions of torchquad, an array-like object will be returned.
    warnings.warn(

torchquad/tests/boole_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /home/conda/feedstock_root/build_artifacts/pytorch-recipe_1680607356157/work/aten/src/ATen/native/TensorShape.cpp:3483.)
    return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor.py:878: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
    return torch.tensor(other, dtype=dtype, device=self.device) ** self

torchquad/tests/boole_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/boole.py:67: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    n_per_dim = int(N ** (1.0 / dim) + 1e-8)

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/utils.py:192: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if dim < 1:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/utils.py:194: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if num_bounds != 2:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/integration_grid.py:112: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if N ** (1.0 / dim) < 2:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/integration_grid.py:57: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    self._N = int(N ** (1.0 / self._dim) + 1e-8)  # convert to points per dim

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/grid_integrator.py:221: TracerWarning: torch.Tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
    torch.Tensor([n_per_dim]),

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/grid_integrator.py:86: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    assert new_shape == list(

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:548: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if self.numel() == 0 and not self.is_sparse:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:288: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if self.numel() == 0:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:327: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    formatter = _Formatter(get_summarized_data(self) if summarize else self)

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:119: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if nonzero_finite_vals.numel() == 0:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:128: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
    for value in nonzero_finite_vals:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:129: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if value != torch.ceil(value):

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:153: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    nonzero_finite_max / nonzero_finite_min > 1000.0

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:154: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    or nonzero_finite_max > 1.0e8

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:155: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    or nonzero_finite_min < 1.0e-4

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:164: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
    for value in nonzero_finite_vals:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor.py:872: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    return self.item().__format__(format_spec)

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:231: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if summarize and self.size(0) > 2 * PRINT_OPTS.edgeitems:

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:238: TracerWarning: Converting a tensor to a Python list might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    data = [_val_formatter(val) for val in self.tolist()]

torchquad/tests/boole_test.py::test_integrate_torch
torchquad/tests/gauss_test.py::test_integrate_torch
torchquad/tests/monte_carlo_test.py::test_integrate_torch
torchquad/tests/simpson_test.py::test_integrate_torch
torchquad/tests/trapezoid_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:259: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    if summarize and self.size(0) > 2 * PRINT_OPTS.edgeitems:

torchquad/tests/boole_test.py::test_integrate_tensorflow
torchquad/tests/monte_carlo_test.py::test_integrate_tensorflow
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/tensorflow/python/autograph/impl/api.py:371: UserWarning: DEPRECATION WARNING: In future versions of torchquad, an array-like object will be returned.
    return py_builtins.overload_of(f)(*args)

torchquad/tests/gauss_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/autoray/autoray.py:79: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
    return get_lib_fn(backend, fn)(*args, **kwargs)

torchquad/tests/gauss_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/autoray/autoray.py:79: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
    return get_lib_fn(backend, fn)(*args, **kwargs)

torchquad/tests/monte_carlo_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:137: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    nonzero_finite_max / nonzero_finite_min > 1000.0

torchquad/tests/monte_carlo_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:138: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    or nonzero_finite_max > 1.0e8

torchquad/tests/monte_carlo_test.py::test_integrate_torch
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/torch/_tensor_str.py:147: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
    for value in nonzero_finite_vals:

torchquad/tests/monte_carlo_test.py::test_integrate_jax
  /home/runner/micromamba-root/envs/torchquad/lib/python3.10/site-packages/autoray/autoray.py:79: UserWarning: Explicitly requested dtype <class 'jax.numpy.float64'> requested in array is not available, and will be truncated to dtype float32. To enable more dtypes, set the jax_enable_x64 configuration option or the JAX_ENABLE_X64 shell environment variable. See https://github.com/google/jax#current-gotchas for more.
    return get_lib_fn(backend, fn)(*args, **kwargs)

torchquad/tests/simpson_test.py::test_integrate_torch
  /home/runner/work/torchquad/torchquad/torchquad/tests/../integration/simpson.py:65: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    n_per_dim = int(N ** (1.0 / dim) + 1e-8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant