fix numpy1.24 deprecations in unittests (#93997)

Fixes https://github.com/pytorch/pytorch/issues/91329

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93997
Approved by: https://github.com/ngimel, https://github.com/jerryzh168
This commit is contained in:
Yuxin Wu
2023-02-18 00:59:06 +00:00
committed by PyTorch MergeBot
parent 9dbfca7840
commit 9bb2fe3eae
6 changed files with 10 additions and 9 deletions

View File

@ -807,7 +807,7 @@ class TestTensorBoardNumpy(BaseTestCase):
model = ModelHelper(name="mnist")
# how come those inputs don't break the forward pass =.=a
workspace.FeedBlob("data", np.random.randn(1, 3, 64, 64).astype(np.float32))
workspace.FeedBlob("label", np.random.randn(1, 1000).astype(np.int))
workspace.FeedBlob("label", np.random.randn(1, 1000).astype(int))
with core.NameScope("conv1"):
conv1 = brew.conv(model, "data", 'conv1', dim_in=1, dim_out=20, kernel=5)
@ -842,7 +842,7 @@ class TestTensorBoardNumpy(BaseTestCase):
def test_caffe2_simple_cnnmodel(self):
model = cnn.CNNModelHelper("NCHW", name="overfeat")
workspace.FeedBlob("data", np.random.randn(1, 3, 64, 64).astype(np.float32))
workspace.FeedBlob("label", np.random.randn(1, 1000).astype(np.int))
workspace.FeedBlob("label", np.random.randn(1, 1000).astype(int))
with core.NameScope("conv1"):
conv1 = model.Conv("data", "conv1", 3, 96, 11, stride=4)
relu1 = model.Relu(conv1, conv1)