Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61585754
utils.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 7, 15:25
Size
670 B
Mime Type
text/x-python
Expires
Thu, May 9, 15:25 (2 d)
Engine
blob
Format
Raw Data
Handle
17531546
Attached To
R10607 weightmatrices
utils.py
View Options
import
torch
from
torchvision
import
datasets
,
transforms
from
sklearn.preprocessing
import
normalize
def
load_data
(
dataset
=
'EMNIST'
,
batch_size
=
100000
):
if
dataset
==
'EMNIST'
:
trans
=
transforms
.
Compose
([
transforms
.
ToTensor
(),
transforms
.
Normalize
((
0.5
,),
(
1.0
,))])
data
=
datasets
.
EMNIST
(
'./datasets/'
,
'bymerge'
,
transform
=
trans
,
download
=
True
)
data_loader
=
torch
.
utils
.
data
.
DataLoader
(
dataset
=
data
,
batch_size
=
batch_size
,
shuffle
=
False
,
drop_last
=
True
)
return
data_loader
def
normalise_weightmatrix
(
W
):
return
normalize
(
W
)
Event Timeline
Log In to Comment