Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.tensorflow
Commits
f6d1eba1
Commit
f6d1eba1
authored
7 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[layers] fixed the concatenation of the conditional variable
parent
735979b1
No related branches found
No related tags found
1 merge request
!8
Gan
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/learn/tensorflow/layers/ConditionConcat.py
+1
-3
1 addition, 3 deletions
bob/learn/tensorflow/layers/ConditionConcat.py
bob/learn/tensorflow/layers/ImToCondFeatureMap.py
+9
-5
9 additions, 5 deletions
bob/learn/tensorflow/layers/ImToCondFeatureMap.py
with
10 additions
and
8 deletions
bob/learn/tensorflow/layers/ConditionConcat.py
+
1
−
3
View file @
f6d1eba1
...
...
@@ -46,7 +46,5 @@ class ConditionConcat(Layer):
def
get_graph
(
self
,
y
):
batch_size
=
input_layer
.
get_shape
()[
0
]
yb
=
tf
.
reshape
(
y
,
[
batch_size
,
1
,
1
,
self
.
conditional_dim
])
return
tf
.
concat
([
input_layer
,
y
],
1
)
return
tf
.
concat
([
self
.
input_layer
,
y
],
1
)
This diff is collapsed.
Click to expand it.
bob/learn/tensorflow/layers/ImToCondFeatureMap.py
+
9
−
5
View file @
f6d1eba1
...
...
@@ -46,6 +46,8 @@ class ImToCondFeatureMap(Layer):
use_gpu
=
False
)
self
.
conditional_dim
=
conditional_dim
logger
.
info
(
"
+ adding a Concatenation layer ({0}) +
"
.
format
(
name
))
logger
.
info
(
"
\t
conditional dimension = {0}
"
.
format
(
conditional_dim
))
...
...
@@ -61,9 +63,11 @@ class ImToCondFeatureMap(Layer):
name: y
The conditioning vector (one-hot encoded)
"""
# concatenate them to the image
x_shapes
=
input_layer
.
get_shape
()
y_shapes
=
y
.
get_shape
()
return
tf
.
concat
([
input_layer
,
y
*
tf
.
ones
([
x_shapes
[
0
],
x_shapes
[
1
],
x_shapes
[
2
],
y_shapes
[
3
]])],
3
)
"""
# concatenate to the image
batch_size
=
tf
.
shape
(
self
.
input_layer
)[
0
]
yb
=
tf
.
reshape
(
y
,
[
batch_size
,
1
,
1
,
self
.
conditional_dim
])
x_shapes
=
self
.
input_layer
.
get_shape
()
y_shapes
=
yb
.
get_shape
()
return
tf
.
concat
([
self
.
input_layer
,
yb
*
tf
.
ones
([
x_shapes
[
0
],
x_shapes
[
1
],
x_shapes
[
2
],
y_shapes
[
3
]])],
3
)
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