Skip to content

Commit 655d2e6

Browse files
committed
day2 task upd
1 parent fd7e568 commit 655d2e6

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 2
6+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 13,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import torch\n",
10+
"import numpy as np\n",
11+
"\n",
12+
"arr1 = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15]])\n",
13+
"arr2 = np.array([[3,4,5,6],[7,8,9,10],[11,12,13,14]])\n",
14+
"\n"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 16,
20+
"metadata": {},
21+
"outputs": [
22+
{
23+
"name": "stdout",
24+
"output_type": "stream",
25+
"text": [
26+
"tensor([[ 3, 4, 5, 6],\n",
27+
" [ 7, 8, 9, 10],\n",
28+
" [11, 12, 13, 14]], dtype=torch.int32)\n"
29+
]
30+
}
31+
],
32+
"source": [
33+
"tens1 = torch.from_numpy(arr1)\n",
34+
"tens2 = torch.from_numpy(arr2)\n",
35+
"\n",
36+
"print(tens2)"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 17,
42+
"metadata": {},
43+
"outputs": [
44+
{
45+
"name": "stdout",
46+
"output_type": "stream",
47+
"text": [
48+
"tensor([[ 50, 56, 62, 68],\n",
49+
" [113, 128, 143, 158],\n",
50+
" [176, 200, 224, 248],\n",
51+
" [239, 272, 305, 338],\n",
52+
" [302, 344, 386, 428]], dtype=torch.int32)\n"
53+
]
54+
}
55+
],
56+
"source": [
57+
"ans = torch.mm(tens1, tens2)\n",
58+
"print(ans)"
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": null,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": []
67+
}
68+
],
69+
"metadata": {
70+
"kernelspec": {
71+
"display_name": "Python 3",
72+
"language": "python",
73+
"name": "python3"
74+
},
75+
"language_info": {
76+
"codemirror_mode": {
77+
"name": "ipython",
78+
"version": 3
79+
},
80+
"file_extension": ".py",
81+
"mimetype": "text/x-python",
82+
"name": "python",
83+
"nbconvert_exporter": "python",
84+
"pygments_lexer": "ipython3",
85+
"version": "3.6.8"
86+
}
87+
},
88+
"nbformat": 4,
89+
"nbformat_minor": 2
90+
}

0 commit comments

Comments
 (0)