Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stylegan2
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dsenkin
stylegan2
Commits
938ac88f
Commit
938ac88f
authored
Jun 12, 2020
by
Jeremiah
Browse files
Options
Downloads
Patches
Plain Diff
fixed encoder
parent
358a0468
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dnnlib/tflib/network.py
+11
-4
11 additions, 4 deletions
dnnlib/tflib/network.py
encode_images.py
+1
-0
1 addition, 0 deletions
encode_images.py
with
12 additions
and
4 deletions
dnnlib/tflib/network.py
+
11
−
4
View file @
938ac88f
...
...
@@ -389,6 +389,7 @@ class Network:
minibatch_size
:
int
=
None
,
num_gpus
:
int
=
1
,
assume_frozen
:
bool
=
False
,
custom_inputs
:
Any
=
None
,
**
dynamic_kwargs
)
->
Union
[
np
.
ndarray
,
Tuple
[
np
.
ndarray
,
...],
List
[
np
.
ndarray
]]:
"""
Run this network for the given NumPy array(s), and return the output(s) as NumPy array(s).
...
...
@@ -404,6 +405,7 @@ class Network:
minibatch_size: Maximum minibatch size to use, None = disable batching.
num_gpus: Number of GPUs to use.
assume_frozen: Improve multi-GPU performance by assuming that the trainable parameters will remain changed between calls.
custom_inputs: Allow to use another tensor as input instead of default placeholders.
dynamic_kwargs: Additional keyword arguments to be passed into the network build function.
"""
assert
len
(
in_arrays
)
==
self
.
num_inputs
...
...
@@ -428,6 +430,11 @@ class Network:
# Build graph.
if
key
not
in
self
.
_run_cache
:
with
tfutil
.
absolute_name_scope
(
self
.
scope
+
"
/_Run
"
),
tf
.
control_dependencies
(
None
):
if
custom_inputs
is
not
None
:
with
tf
.
device
(
"
/gpu:0
"
):
in_expr
=
[
input_builder
(
name
)
for
input_builder
,
name
in
zip
(
custom_inputs
,
self
.
input_names
)]
in_split
=
list
(
zip
(
*
[
tf
.
split
(
x
,
num_gpus
)
for
x
in
in_expr
]))
else
:
with
tf
.
device
(
"
/cpu:0
"
):
in_expr
=
[
tf
.
placeholder
(
tf
.
float32
,
name
=
name
)
for
name
in
self
.
input_names
]
in_split
=
list
(
zip
(
*
[
tf
.
split
(
x
,
num_gpus
)
for
x
in
in_expr
]))
...
...
This diff is collapsed.
Click to expand it.
encode_images.py
+
1
−
0
View file @
938ac88f
...
...
@@ -10,6 +10,7 @@ import dnnlib.tflib as tflib
import
pretrained_networks
from
encoder.generator_model
import
Generator
from
encoder.perceptual_model
import
PerceptualModel
from
encoder.perceptual_model
import
load_images
from
keras.models
import
load_model
from
keras.applications.resnet50
import
preprocess_input
...
...
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