Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102690090
loader.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
Sun, Feb 23, 06:25
Size
577 B
Mime Type
text/x-python
Expires
Tue, Feb 25, 06:25 (2 d)
Engine
blob
Format
Raw Data
Handle
24397883
Attached To
R6062 TIGraNet
loader.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Data loader for the PyTorch framework.
"""
from
tqdm
import
tqdm
import
os
,
re
import
torch
import
torch.utils.data
as
data
from
utils
import
select
class
MNIST_bis
(
data
.
Dataset
):
def
__init__
(
self
,
dataset
,
size
,
digits_to_keep
,
stratified_sampling
=
True
):
self
.
dataset
=
dataset
self
.
indices
=
select
(
dataset
,
size
,
digits_to_keep
,
stratified_sampling
)
def
__len__
(
self
):
return
len
(
self
.
indices
)
def
__getitem__
(
self
,
idx
):
return
self
.
dataset
[
self
.
indices
[
idx
]]
Event Timeline
Log In to Comment