FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-python/tests/test_pytorch.py at master · feibyte/docker-python · GitHub
feibyte
/
docker-python
Public
forked from
Kaggle/docker-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-python
/
tests
/
test_pytorch.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (27 loc) · 960 Bytes
Breadcrumbs
docker-python
/
tests
/
test_pytorch.py
Copy path
File metadata and controls
35 lines (27 loc) · 960 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import
unittest
import
torch
import
torch
.
nn
as
tnn
import
torch
.
autograd
as
autograd
from
common
import
gpu_test
class
TestPyTorch
(
unittest
.
TestCase
):
# PyTorch smoke test based on http://pytorch.org/tutorials/beginner/nlp/deep_learning_tutorial.html
def
test_nn
(
self
):
torch
.
manual_seed
(
31337
)
linear_torch
=
tnn
.
Linear
(
5
,
3
)
data_torch
=
autograd
.
Variable
(
torch
.
randn
(
2
,
5
))
linear_torch
(
data_torch
)
@
gpu_test
def
test_gpu_computation
(
self
):
cuda
=
torch
.
device
(
'cuda'
)
a
=
torch
.
tensor
([
1.
,
2.
],
device
=
cuda
)
result
=
a
.
sum
()
self
.
assertEqual
(
torch
.
tensor
([
3.
],
device
=
cuda
),
result
)
@
gpu_test
def
test_cuda_nn
(
self
):
# These throw if cuda is misconfigured
tnn
.
GRUCell
(
10
,
10
).
cuda
()
tnn
.
RNNCell
(
10
,
10
).
cuda
()
tnn
.
LSTMCell
(
10
,
10
).
cuda
()
tnn
.
GRU
(
10
,
10
).
cuda
()
tnn
.
LSTM
(
10
,
10
).
cuda
()
tnn
.
RNN
(
10
,
10
).
cuda
()
Back
|
FazBrowse Home
|
New Git URL