Skip to content

Commit 21e004d

Browse files
committed
Add pytorch tests
1 parent ccad084 commit 21e004d

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

tests/babel-formatting.org

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,3 +486,44 @@ print(x)
486486
│ │ [-0.6745, 0.0472, -0.8954]])
487487
:end:
488488

489+
490+
491+
#+begin_src python
492+
import torch
493+
494+
# Test tensor
495+
x = torch.randn(3, 3)
496+
print("Tensor:", x)
497+
# Test dict
498+
d = {"name": "Alice", "age": 30, "city": "New York", "hobbies": ["reading", "coding"]}
499+
print("Dict:", d)
500+
501+
# Test list
502+
l = [1, 2, 3, [4, 5, 6], {"nested": "dict"}]
503+
print("List:", l)
504+
505+
# Test set
506+
s = {1, 2, 3, 4, 5}
507+
print("Set:", s)
508+
import os
509+
os.path
510+
print(100)
511+
#+end_src
512+
513+
#+RESULTS:
514+
:results:
515+
Tensor:
516+
tensor([[-1.3200, 1.4083, 1.1319],
517+
│ │ [-0.6430, -1.6252, -1.3978],
518+
│ │ [ 1.0347, 1.5210, 1.5890]])
519+
Dict:
520+
{'name': 'Alice', 'age': 30, 'city': 'New York', 'hobbies': ['reading', 'coding']}
521+
List:
522+
[1, 2, 3, [4, 5, 6], {'nested': 'dict'}]
523+
Set:
524+
{1, 2, 3, 4, 5}
525+
100
526+
:end:
527+
528+
529+

0 commit comments

Comments
 (0)