Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60574534
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
Wed, May 1, 04:58
Size
806 B
Mime Type
text/x-python
Expires
Fri, May 3, 04:58 (2 d)
Engine
blob
Format
Raw Data
Handle
17377516
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
getbigdatamatrix
(
data_loader
):
# Needed for ICA and SC and stuff...
# loop over data_loader and concatenation
return
X
def
normalise_weightmatrix
(
W
):
return
normalize
(
W
)
Event Timeline
Log In to Comment