summaryrefslogtreecommitdiff
path: root/candle-core/tests/pth.py
diff options
context:
space:
mode:
authorRoma Klapaukh <rklapaukh@hotmail.com>2024-02-06 18:50:55 +1100
committerGitHub <noreply@github.com>2024-02-06 08:50:55 +0100
commit1ba11f22d68a26f34e226490900640d06996a5f4 (patch)
tree4f3583bcea2751ec3d25bab1d60d08e31cd13905 /candle-core/tests/pth.py
parent982722019b2b844dc27878cfa31b4af7dcacacc5 (diff)
downloadcandle-1ba11f22d68a26f34e226490900640d06996a5f4.tar.gz
candle-1ba11f22d68a26f34e226490900640d06996a5f4.tar.bz2
candle-1ba11f22d68a26f34e226490900640d06996a5f4.zip
Fix: pth files don't load on Windows (#1661)
* Don't treat zip path as OS path * Add a test case * Add code to generate test pth data
Diffstat (limited to 'candle-core/tests/pth.py')
-rw-r--r--candle-core/tests/pth.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/candle-core/tests/pth.py b/candle-core/tests/pth.py
new file mode 100644
index 00000000..97724712
--- /dev/null
+++ b/candle-core/tests/pth.py
@@ -0,0 +1,8 @@
+import torch
+from collections import OrderedDict
+
+# Write a trivial tensor to a pt file
+a= torch.tensor([[1,2,3,4], [5,6,7,8]])
+o = OrderedDict()
+o["test"] = a
+torch.save(o, "test.pt")