Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OvoTools
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林帅浩
OvoTools
Commits
1919f600
Commit
1919f600
authored
Oct 04, 2019
by
Ilya Ovodov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CachedDataSet
parent
981c0a29
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
__init__.py
ovotools/pytorch/__init__.py
+2
-0
cached_dataset.py
ovotools/pytorch/cached_dataset.py
+16
-0
No files found.
ovotools/pytorch/__init__.py
View file @
1919f600
from
.threading_dataloader
import
BatchThreadingDataLoader
,
ThreadingDataLoader
from
.cached_dataset
import
CachedDataSet
\ No newline at end of file
ovotools/pytorch/cached_dataset.py
0 → 100644
View file @
1919f600
class
CachedDataSet
:
'''
provides caching dataset items in memory
'''
def
__init__
(
self
,
dataset
):
self
.
dataset
=
dataset
self
.
cache
=
[
None
]
*
len
(
dataset
)
def
__len__
(
self
):
return
len
(
self
.
dataset
)
def
__getitem__
(
self
,
index
):
if
self
.
cache
[
index
]
is
None
:
self
.
cache
[
index
]
=
self
.
dataset
[
index
]
return
self
.
cache
[
index
]
\ No newline at end of file
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