File: test_lib.py

package info (click to toggle)
eagerpy 0.30.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 440 kB
  • sloc: python: 3,914; makefile: 73; javascript: 38; sh: 30
file content (8 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
import pytest
import eagerpy as ep


@pytest.mark.parametrize("axis", [0, 1, -1])
def test_kl_div_with_logits(dummy: ep.Tensor, axis: int) -> None:
    logits_p = logits_q = ep.arange(dummy, 12).float32().reshape((3, 4))
    assert (ep.kl_div_with_logits(logits_p, logits_q, axis=axis) == 0).all()