| 1 | import torch |
| 2 | from torch.autogradscip-python python iisignature 0.24 `torch.autograd`/__init__: import Variable |
| 3 | # from torch.nn.modules.module import Module |
| 4 | |
| 5 | import osscip-python python python-stdlib 3.11 os/__init__: |
| 6 | import sysscip-python python python-stdlib 3.11 sys/__init__: |
| 7 | |
| 8 | sysscip-python python python-stdlib 3.11 sys/__init__:.pathscip-python python python-stdlib 3.11 sys/path.path..appendscip-python python python-stdlib 3.11 builtins/list#append().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..dirnamescip-python python python-stdlib 3.11 posixpath/dirname().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..abspathscip-python python python-stdlib 3.11 posixpath/dirname().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..dirnamescip-python python python-stdlib 3.11 posixpath/dirname().(__file__scip-python python python-stdlib 3.11 builtins/__file__#)))) |
| 9 | import iisignature |
| 10 | |
| 11 | from iisignature_torchscip-python python iisignature 0.24 iisignature_torch/__init__: import Sigscip-python python iisignature 0.24 `examples.iisignature_torch`/Sig()., LogSigscip-python python iisignature 0.24 `examples.iisignature_torch`/LogSig()., SigJoinscip-python python iisignature 0.24 `examples.iisignature_torch`/SigJoin()., SigScalescip-python python iisignature 0.24 `examples.iisignature_torch`/SigScale(). |
| 12 | |
| 13 | |
| 14 | def trySigscip-python python iisignature 0.24 `examples.demo_torch`/trySig().(): |
| 15 | inp = Variable(torch.randn(8, 2), requires_grad=True) |
| 16 | result = Sigscip-python python iisignature 0.24 `examples.iisignature_torch`/Sig().(inp, 2) |
| 17 | printscip-python python python-stdlib 3.11 builtins/print().(result.data) |
| 18 | result.backward(torch.randn(result.size())) |
| 19 | printscip-python python python-stdlib 3.11 builtins/print().(inp.grad) |
| 20 | |
| 21 | |
| 22 | trySigscip-python python iisignature 0.24 `examples.demo_torch`/trySig().() |
| 23 | |
| 24 | |
| 25 | def tryLogSigscip-python python iisignature 0.24 `examples.demo_torch`/tryLogSig().(): |
| 26 | s = iisignature.prepare(2, 2) |
| 27 | for expanded in (False, True): |
| 28 | inp = Variable(torch.randn(8, 2), requires_grad=True) |
| 29 | if expanded: |
| 30 | result = LogSigscip-python python iisignature 0.24 `examples.iisignature_torch`/LogSig().(inp, s, "x") |
| 31 | else: |
| 32 | result = LogSigscip-python python iisignature 0.24 `examples.iisignature_torch`/LogSig().(inp, s) |
| 33 | printscip-python python python-stdlib 3.11 builtins/print().(result.data.numpy()) |
| 34 | result.backward(torch.randn(result.size())) |
| 35 | printscip-python python python-stdlib 3.11 builtins/print().(inp.grad.data) |
| 36 | |
| 37 | |
| 38 | tryLogSigscip-python python iisignature 0.24 `examples.demo_torch`/tryLogSig().() |
| 39 | |
| 40 | |
| 41 | def trySigScalescip-python python iisignature 0.24 `examples.demo_torch`/trySigScale().(): |
| 42 | inp1 = Variable(torch.randn(12, 6), requires_grad=True) |
| 43 | inp2 = Variable(torch.randn(12, 2), requires_grad=True) |
| 44 | result = SigScalescip-python python iisignature 0.24 `examples.iisignature_torch`/SigScale().(inp1, inp2, 2) |
| 45 | printscip-python python python-stdlib 3.11 builtins/print().(result.data) |
| 46 | result.backward(torch.randn(result.size())) |
| 47 | printscip-python python python-stdlib 3.11 builtins/print().(inp1.grad) |
| 48 | printscip-python python python-stdlib 3.11 builtins/print().(inp2.grad) |
| 49 | |
| 50 | |
| 51 | trySigScalescip-python python iisignature 0.24 `examples.demo_torch`/trySigScale().() |
| 52 | |
| 53 | |
| 54 | def trySigJoinscip-python python iisignature 0.24 `examples.demo_torch`/trySigJoin().(): |
| 55 | inp1 = Variable(torch.randn(12, 6), requires_grad=True) |
| 56 | inp2 = Variable(torch.randn(12, 2), requires_grad=True) |
| 57 | result = SigJoinscip-python python iisignature 0.24 `examples.iisignature_torch`/SigJoin().(inp1, inp2, 2) |
| 58 | printscip-python python python-stdlib 3.11 builtins/print().(result.data) |
| 59 | result.backward(torch.randn(result.size())) |
| 60 | printscip-python python python-stdlib 3.11 builtins/print().(inp1.grad) |
| 61 | printscip-python python python-stdlib 3.11 builtins/print().(inp2.grad) |
| 62 | |
| 63 | |
| 64 | trySigJoinscip-python python iisignature 0.24 `examples.demo_torch`/trySigJoin().() |
| 65 | |
| 66 | |
| 67 | def trySigJoin2scip-python python iisignature 0.24 `examples.demo_torch`/trySigJoin2().(): |
| 68 | inp1 = Variable(torch.randn(12, 12), requires_grad=True) |
| 69 | inp2 = Variable(torch.randn(12, 2), requires_grad=True) |
| 70 | inp3 = Variable(torch.randn(1), requires_grad=True) |
| 71 | result = SigJoinscip-python python iisignature 0.24 `examples.iisignature_torch`/SigJoin().(inp1, inp2, 2, inp3) |
| 72 | printscip-python python python-stdlib 3.11 builtins/print().(result.data) |
| 73 | result.backward(torch.randn(result.size())) |
| 74 | printscip-python python python-stdlib 3.11 builtins/print().(inp1.grad) |
| 75 | printscip-python python python-stdlib 3.11 builtins/print().(inp2.grad) |
| 76 | printscip-python python python-stdlib 3.11 builtins/print().(inp3.grad) |
| 77 | |
| 78 | |
| 79 | trySigJoin2scip-python python iisignature 0.24 `examples.demo_torch`/trySigJoin2().() |