Skip to content

Commit 1655d0a

Browse files
spzalasekyondaMetasvekars
authored
Update Polynomial Tensor example with torch api (#3884)
Fixes# #3879 ## Description torch.pi available since PyTorch 1.8.0 so use it instead of extra math call. The changes made are tested and made sure that it produce the desired output. Signed-off-by: Sahdev Zala <spzala@us.ibm.com> Co-authored-by: sekyondaMeta <127536312+sekyondaMeta@users.noreply.github.com> Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
1 parent 052123a commit 1655d0a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

beginner_source/examples_tensor/polynomial_tensor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919
"""
2020

2121
import torch
22-
import math
23-
2422

2523
dtype = torch.float
2624
device = torch.device("cpu")
2725
# device = torch.device("cuda:0") # Uncomment this to run on GPU
2826

2927
# Create random input and output data
30-
x = torch.linspace(-math.pi, math.pi, 2000, device=device, dtype=dtype)
28+
x = torch.linspace(-torch.pi, torch.pi, 2000, device=device, dtype=dtype)
3129
y = torch.sin(x)
3230

3331
# Randomly initialize weights

0 commit comments

Comments
 (0)