Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
f1d7c92d
Unverified
Commit
f1d7c92d
authored
Jul 31, 2020
by
Philip Meier
Committed by
GitHub
Jul 31, 2020
Browse files
fakedata (#2528)
parent
5405739e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
torchvision/datasets/fakedata.py
torchvision/datasets/fakedata.py
+13
-5
No files found.
torchvision/datasets/fakedata.py
View file @
f1d7c92d
import
torch
from
typing
import
Any
,
Callable
,
Optional
,
Tuple
from
.vision
import
VisionDataset
from
..
import
transforms
...
...
@@ -19,16 +20,23 @@ class FakeData(VisionDataset):
"""
def
__init__
(
self
,
size
=
1000
,
image_size
=
(
3
,
224
,
224
),
num_classes
=
10
,
transform
=
None
,
target_transform
=
None
,
random_offset
=
0
):
super
(
FakeData
,
self
).
__init__
(
None
,
transform
=
transform
,
def
__init__
(
self
,
size
:
int
=
1000
,
image_size
:
Tuple
[
int
,
int
,
int
]
=
(
3
,
224
,
224
),
num_classes
:
int
=
10
,
transform
:
Optional
[
Callable
]
=
None
,
target_transform
:
Optional
[
Callable
]
=
None
,
random_offset
:
int
=
0
,
)
->
None
:
super
(
FakeData
,
self
).
__init__
(
None
,
transform
=
transform
,
# type: ignore[arg-type]
target_transform
=
target_transform
)
self
.
size
=
size
self
.
num_classes
=
num_classes
self
.
image_size
=
image_size
self
.
random_offset
=
random_offset
def
__getitem__
(
self
,
index
)
:
def
__getitem__
(
self
,
index
:
int
)
->
Tuple
[
Any
,
Any
]
:
"""
Args:
index (int): Index
...
...
@@ -54,5 +62,5 @@ class FakeData(VisionDataset):
return
img
,
target
def
__len__
(
self
):
def
__len__
(
self
)
->
int
:
return
self
.
size
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment