Skip to content
Open
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dev = [
"pytest>=8.3.4",
"protobuf==4.22.3",
"torch>=2.5.1",
"torchvision>=0.20.1",
"torchvision==0.20.1",
"numpy>=2.0.2",
"tensorboard>=2.18.0",
"boto3>=1.35.81",
Expand Down
2 changes: 1 addition & 1 deletion tensorboardX/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def hparams(hparam_dict=None, metric_dict=None):
continue

if isinstance(v, (int, float)):
v = make_np(v)[0]
v = float(make_np(v))
ssi.hparams[k].number_value = v
hps.append(HParamInfo(name=k, type=DataType.Value("DATA_TYPE_FLOAT64")))
continue
Expand Down
2 changes: 1 addition & 1 deletion tensorboardX/x2num.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def make_np(x):
if isinstance(x, np.ndarray):
return check_nan(x)
if np.isscalar(x):
return check_nan(np.array([x]))
return check_nan(np.array(x))
if 'torch' in str(type(x)):
return check_nan(prepare_pytorch(x))
if 'chainer' in str(type(x)):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
class NumpyTest(unittest.TestCase):
def test_scalar(self):
res = x2num.make_np(1.1)
assert isinstance(res, np.ndarray) and res.shape == (1,)
assert isinstance(res, np.ndarray) and res.shape == ()
res = x2num.make_np(1 << 64 - 1) # uint64_max
assert isinstance(res, np.ndarray) and res.shape == (1,)
assert isinstance(res, np.ndarray) and res.shape == ()
res = x2num.make_np(np.float16(1.00000087))
assert isinstance(res, np.ndarray) and res.shape == (1,)
assert isinstance(res, np.ndarray) and res.shape == ()
if hasattr(np, 'float128'):
res = x2num.make_np(np.float128(1.00008 + 9))
assert isinstance(res, np.ndarray) and res.shape == (1,)
assert isinstance(res, np.ndarray) and res.shape == ()
res = x2num.make_np(np.int64(100000000000))
assert isinstance(res, np.ndarray) and res.shape == (1,)
assert isinstance(res, np.ndarray) and res.shape == ()

def test_make_grid(self):
pass
Expand Down
33 changes: 0 additions & 33 deletions tests/test_visdom.py

This file was deleted.