From 89b3343bfac82fc3cacf97cf4e8f11edacb571a4 Mon Sep 17 00:00:00 2001 From: ibartol <50273483+ignaciobartol@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:04:42 -0400 Subject: [PATCH] Updated linalg functions in tensors_deeper_tutorial.py (#2959) Co-authored-by: Svetlana Karslioglu --- beginner_source/introyt/tensors_deeper_tutorial.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/beginner_source/introyt/tensors_deeper_tutorial.py b/beginner_source/introyt/tensors_deeper_tutorial.py index b5f9dc0bc9..d7293dfe29 100644 --- a/beginner_source/introyt/tensors_deeper_tutorial.py +++ b/beginner_source/introyt/tensors_deeper_tutorial.py @@ -448,17 +448,19 @@ m2 = torch.tensor([[3., 0.], [0., 3.]]) # three times identity matrix print('\nVectors & Matrices:') -print(torch.cross(v2, v1)) # negative of z unit vector (v1 x v2 == -v2 x v1) +print(torch.linalg.cross(v2, v1)) # negative of z unit vector (v1 x v2 == -v2 x v1) print(m1) -m3 = torch.matmul(m1, m2) +m3 = torch.linalg.matmul(m1, m2) print(m3) # 3 times m1 -print(torch.svd(m3)) # singular value decomposition +print(torch.linalg.svd(m3)) # singular value decomposition ################################################################################## # This is a small sample of operations. For more details and the full inventory of # math functions, have a look at the # `documentation `__. +# For more details and the full inventory of linear algebra operations, have a +# look at this `documentation `__. # # Altering Tensors in Place # ~~~~~~~~~~~~~~~~~~~~~~~~~