Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
ab17f3f1
Commit
ab17f3f1
authored
4 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Fixing LeNet model
parent
09a7c251
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hpvm/projects/keras/src/lenet.py
+10
-12
10 additions, 12 deletions
hpvm/projects/keras/src/lenet.py
with
10 additions
and
12 deletions
hpvm/projects/keras/src/lenet.py
+
10
−
12
View file @
ab17f3f1
...
@@ -26,7 +26,7 @@ class LeNet_MNIST(Benchmark):
...
@@ -26,7 +26,7 @@ class LeNet_MNIST(Benchmark):
def
buildModel
(
self
):
def
buildModel
(
self
):
# Network Compostion:
3
Conv Layers, 2 Dense Layers
# Network Compostion:
2
Conv Layers, 2 Dense Layers
model
=
Sequential
()
model
=
Sequential
()
# ConvLayer1
# ConvLayer1
...
@@ -40,10 +40,10 @@ class LeNet_MNIST(Benchmark):
...
@@ -40,10 +40,10 @@ class LeNet_MNIST(Benchmark):
model
.
add
(
Flatten
())
model
.
add
(
Flatten
())
# DenseLayer1
# DenseLayer1
model
.
add
(
Dense
(
1024
,
activation
=
'
relu
'
))
model
.
add
(
Dense
(
1024
,
activation
=
'
tanh
'
))
# DenseLayer2
# DenseLayer2
model
.
add
(
Dense
(
self
.
num_classes
,
activation
=
'
relu
'
))
model
.
add
(
Dense
(
self
.
num_classes
,
activation
=
'
tanh
'
))
# Softmax Layer
# Softmax Layer
model
.
add
(
Activation
(
'
softmax
'
))
model
.
add
(
Activation
(
'
softmax
'
))
...
@@ -55,18 +55,16 @@ class LeNet_MNIST(Benchmark):
...
@@ -55,18 +55,16 @@ class LeNet_MNIST(Benchmark):
test_labels
=
y_val
test_labels
=
y_val
X_train
=
X_train
.
reshape
(
X_train
.
shape
[
0
],
1
,
28
,
28
)
X_train
=
X_train
.
reshape
(
X_train
.
shape
[
0
],
1
,
28
,
28
)
X_val
=
X_val
.
reshape
(
X_val
.
shape
[
0
],
1
,
28
,
28
)
X_train
=
X_train
.
astype
(
'
float32
'
)
X_train
=
X_train
.
astype
(
'
float32
'
)
X_val
=
X_val
.
astype
(
'
float32
'
)
X_train
/=
255
X_train
/=
255
X_val
/=
255
X_test
=
X_val
[
0
:
5000
]
X_test
=
np
.
fromfile
(
MODEL_PARAMS_DIR
+
'
/lenet_mnist/test_input.bin
'
,
dtype
=
np
.
float32
)
y_test
=
y_val
[
0
:
5000
]
X_test
=
X_test
.
reshape
((
-
1
,
1
,
28
,
28
))
X_tuner
=
X_val
[
5000
:]
y_test
=
np
.
fromfile
(
MODEL_PARAMS_DIR
+
'
/lenet_mnist/test_labels.bin
'
,
dtype
=
np
.
uint32
)
y_tuner
=
y_val
[
5000
:]
X_tuner
=
np
.
fromfile
(
MODEL_PARAMS_DIR
+
'
/lenet_mnist/tune_input.bin
'
,
dtype
=
np
.
float32
)
X_tuner
=
X_tuner
.
reshape
((
-
1
,
1
,
28
,
28
))
y_tuner
=
np
.
fromfile
(
MODEL_PARAMS_DIR
+
'
/lenet_mnist/tune_labels.bin
'
,
dtype
=
np
.
uint32
)
return
X_train
,
y_train
,
X_test
,
y_test
,
X_tuner
,
y_tuner
return
X_train
,
y_train
,
X_test
,
y_test
,
X_tuner
,
y_tuner
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment