def test_get_float_value() -> None: assert 1.0 == ChainerPruningExtension._get_float_value(1.0) assert 1.0 == ChainerPruningExtension._get_float_value(chainer.Variable(np.array([1.0]))) assert math.isnan(ChainerPruningExtension._get_float_value(float("nan"))) with pytest.raises(TypeError): ChainerPruningExtension._get_float_value([]) # type: ignore
def test_get_float_value() -> None: assert 1.0 == ChainerPruningExtension._get_float_value(1.0) assert 1.0 == ChainerPruningExtension._get_float_value(chainer.Variable(np.array([1.0]))) assert math.isnan(ChainerPruningExtension._get_float_value(float("nan")))