Update.
authorFrancois Fleuret <francois@fleuret.org>
Fri, 10 Apr 2020 21:19:32 +0000 (23:19 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Fri, 10 Apr 2020 21:19:32 +0000 (23:19 +0200)
poly.py

diff --git a/poly.py b/poly.py
index ae9f88e..818742b 100755 (executable)
--- a/poly.py
+++ b/poly.py
@@ -5,6 +5,8 @@
 
 # Written by Francois Fleuret <francois@fleuret.org>
 
+######################################################################
+
 import torch
 
 def pol_prod(a, b):
@@ -22,8 +24,10 @@ def pol_prim(a):
     n[1:] = a / n[1:]
     return n
 
-a = torch.tensor([1., 2., 3.])
-b = torch.tensor([2., 5.])
+######################################################################
 
-print(pol_prod(a, b))
-print(pol_prim(b))
+if __name__ == '__main__':
+    a = torch.tensor([1., 2., 3.])
+    b = torch.tensor([2., 5.])
+    print(pol_prod(a, b))
+    print(pol_prim(b))