forked from FluxML/Flux.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Data.jl
68 lines (51 loc) · 1.29 KB
/
Data.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module Data
using Random: shuffle!
using Base: @propagate_inbounds
include("dataloader.jl")
export DataLoader
## TODO for v0.13: remove everything below ##############
## Also remove the following deps:
## AbstractTrees, ZipFiles, CodecZLib
import ..Flux
import SHA
deprecation_message() = @warn("Flux's datasets are deprecated, please use the package MLDatasets.jl")
function deps(path...)
if isnothing(@__DIR__) # sysimages
joinpath("deps", path...)
else
joinpath(@__DIR__, "..", "..", "deps", path...)
end
end
function download_and_verify(url, path, hash)
tmppath = tempname()
download(url, tmppath)
hash_download = open(tmppath) do f
bytes2hex(SHA.sha256(f))
end
if hash_download !== hash
msg = "Hash Mismatch!\n"
msg *= " Expected sha256: $hash\n"
msg *= " Calculated sha256: $hash_download"
error(msg)
end
mv(tmppath, path; force=true)
end
function __init__()
mkpath(deps())
end
include("mnist.jl")
export MNIST
include("fashion-mnist.jl")
export FashionMNIST
include("cmudict.jl")
export CMUDict
using .CMUDict; export cmudict
include("tree.jl")
include("sentiment.jl")
export Sentiment
include("iris.jl")
export Iris
include("housing.jl")
export Housing
#########################################
end#module