Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
deepFriedConvnet
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
Container Registry
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
Luc Giffon
deepFriedConvnet
Commits
85230ebd
Commit
85230ebd
authored
7 years ago
by
Luc Giffon
Browse files
Options
Downloads
Patches
Plain Diff
nystrom approx now use common function for conv relu pooling
parent
13fac76c
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
main/nystrom/nystrom_approx.py
+7
-25
7 additions, 25 deletions
main/nystrom/nystrom_approx.py
with
7 additions
and
25 deletions
main/nystrom/nystrom_approx.py
+
7
−
25
View file @
85230ebd
...
@@ -5,10 +5,9 @@ Convnet with nystrom approximation of the feature map.
...
@@ -5,10 +5,9 @@ Convnet with nystrom approximation of the feature map.
import
tensorflow
as
tf
import
tensorflow
as
tf
import
numpy
as
np
import
numpy
as
np
from
sklearn.metrics.pairwise
import
rbf_kernel
import
skluc.mldatasets
as
dataset
import
skluc.mldatasets
as
dataset
from
skluc.neural_networks
import
bias_variable
,
weight_variable
,
conv2d
,
max_pool_2x2
,
conv_relu_pool
,
get_next_batch
from
skluc.neural_networks
import
bias_variable
,
weight_variable
,
conv_relu_pool
,
get_next_batch
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
ERROR
)
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
ERROR
)
...
@@ -43,29 +42,12 @@ NYSTROM_SAMPLE_SIZE = 500
...
@@ -43,29 +42,12 @@ NYSTROM_SAMPLE_SIZE = 500
X_nystrom
=
X_train
[
np
.
random
.
permutation
(
NYSTROM_SAMPLE_SIZE
)]
X_nystrom
=
X_train
[
np
.
random
.
permutation
(
NYSTROM_SAMPLE_SIZE
)]
def
convolution_mnist
(
input
,
trainable
=
True
):
def
convolution_mnist
(
input_
,
trainable
=
True
):
with
tf
.
name_scope
(
"
conv_pool_1
"
):
with
tf
.
variable_scope
(
"
conv_pool_1
"
):
# 32 is the number of filter we'll use. e.g. the number of different
conv1
=
conv_relu_pool
(
input_
,
[
5
,
5
,
1
,
20
],
[
20
],
trainable
=
trainable
)
# shapes this layer is able to recognize
with
tf
.
variable_scope
(
"
conv_pool_2
"
):
W_conv1
=
weight_variable
([
5
,
5
,
1
,
20
],
trainable
=
trainable
)
conv2
=
conv_relu_pool
(
conv1
,
[
5
,
5
,
20
,
50
],
[
50
],
trainable
=
trainable
)
tf
.
summary
.
histogram
(
"
weights conv1
"
,
W_conv1
)
return
conv2
b_conv1
=
bias_variable
([
20
],
trainable
=
trainable
)
tf
.
summary
.
histogram
(
"
biases conv1
"
,
b_conv1
)
# -1 is here to keep the total size constant (784)
h_conv1
=
tf
.
nn
.
relu
(
conv2d
(
input
,
W_conv1
)
+
b_conv1
)
tf
.
summary
.
histogram
(
"
act conv1
"
,
h_conv1
)
h_pool1
=
max_pool_2x2
(
h_conv1
)
with
tf
.
name_scope
(
"
conv_pool_2
"
):
W_conv2
=
weight_variable
([
5
,
5
,
20
,
50
],
trainable
=
trainable
)
tf
.
summary
.
histogram
(
"
weights conv2
"
,
W_conv2
)
b_conv2
=
bias_variable
([
50
],
trainable
=
trainable
)
tf
.
summary
.
histogram
(
"
biases conv2
"
,
b_conv2
)
h_conv2
=
tf
.
nn
.
relu
(
conv2d
(
h_pool1
,
W_conv2
)
+
b_conv2
)
tf
.
summary
.
histogram
(
"
act conv2
"
,
h_conv2
)
h_pool2
=
max_pool_2x2
(
h_conv2
)
return
h_pool2
def
fully_connected
(
conv_out
):
def
fully_connected
(
conv_out
):
...
...
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