From 4ed9fb182e51612e5303cf2842e9b5d5e05e224d Mon Sep 17 00:00:00 2001 From: Peter Steinbach Date: Wed, 4 Mar 2020 14:24:29 +0100 Subject: [PATCH] use explicit assertion to emphasize equality --- tutorials/01-basics/pytorch_basics/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorials/01-basics/pytorch_basics/main.py b/tutorials/01-basics/pytorch_basics/main.py index 744400c2..c475feda 100644 --- a/tutorials/01-basics/pytorch_basics/main.py +++ b/tutorials/01-basics/pytorch_basics/main.py @@ -93,9 +93,11 @@ # Convert the numpy array to a torch tensor. y = torch.from_numpy(x) -# Convert the torch tensor to a numpy array. +# Convert the torch tensor back to a numpy array. z = y.numpy() +# x and z have identical values inside +assert np.all(x == z) # ================================================================== # # 4. Input pipeline #