Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
3256c49f
"...srt/layers/git@developer.sourcefind.cn:change/sglang.git" did not exist on "13bc39c5d631f7783675674fa7615d594ed533b2"
Commit
3256c49f
authored
Dec 11, 2018
by
Priya Gupta
Browse files
allow specifying parse function
parent
c9f03bf6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
official/resnet/cifar10_main.py
official/resnet/cifar10_main.py
+3
-2
official/resnet/imagenet_main.py
official/resnet/imagenet_main.py
+3
-2
No files found.
official/resnet/cifar10_main.py
View file @
3256c49f
...
@@ -111,7 +111,7 @@ def preprocess_image(image, is_training):
...
@@ -111,7 +111,7 @@ def preprocess_image(image, is_training):
def
input_fn
(
is_training
,
data_dir
,
batch_size
,
num_epochs
=
1
,
def
input_fn
(
is_training
,
data_dir
,
batch_size
,
num_epochs
=
1
,
dtype
=
tf
.
float32
,
datasets_num_private_threads
=
None
,
dtype
=
tf
.
float32
,
datasets_num_private_threads
=
None
,
num_parallel_batches
=
1
):
num_parallel_batches
=
1
,
parse_record_fn
=
parse_record
):
"""Input function which provides batches for train or eval.
"""Input function which provides batches for train or eval.
Args:
Args:
...
@@ -122,6 +122,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
...
@@ -122,6 +122,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
dtype: Data type to use for images/features
dtype: Data type to use for images/features
datasets_num_private_threads: Number of private threads for tf.data.
datasets_num_private_threads: Number of private threads for tf.data.
num_parallel_batches: Number of parallel batches for tf.data.
num_parallel_batches: Number of parallel batches for tf.data.
parse_record_fn: Function to use for parsing the records.
Returns:
Returns:
A dataset that can be used for iteration.
A dataset that can be used for iteration.
...
@@ -134,7 +135,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
...
@@ -134,7 +135,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
is_training
=
is_training
,
is_training
=
is_training
,
batch_size
=
batch_size
,
batch_size
=
batch_size
,
shuffle_buffer
=
_NUM_IMAGES
[
'train'
],
shuffle_buffer
=
_NUM_IMAGES
[
'train'
],
parse_record_fn
=
parse_record
,
parse_record_fn
=
parse_record
_fn
,
num_epochs
=
num_epochs
,
num_epochs
=
num_epochs
,
dtype
=
dtype
,
dtype
=
dtype
,
datasets_num_private_threads
=
datasets_num_private_threads
,
datasets_num_private_threads
=
datasets_num_private_threads
,
...
...
official/resnet/imagenet_main.py
View file @
3256c49f
...
@@ -160,7 +160,7 @@ def parse_record(raw_record, is_training, dtype):
...
@@ -160,7 +160,7 @@ def parse_record(raw_record, is_training, dtype):
def
input_fn
(
is_training
,
data_dir
,
batch_size
,
num_epochs
=
1
,
def
input_fn
(
is_training
,
data_dir
,
batch_size
,
num_epochs
=
1
,
dtype
=
tf
.
float32
,
datasets_num_private_threads
=
None
,
dtype
=
tf
.
float32
,
datasets_num_private_threads
=
None
,
num_parallel_batches
=
1
):
num_parallel_batches
=
1
,
parse_record_fn
=
parse_record
):
"""Input function which provides batches for train or eval.
"""Input function which provides batches for train or eval.
Args:
Args:
...
@@ -171,6 +171,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
...
@@ -171,6 +171,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
dtype: Data type to use for images/features
dtype: Data type to use for images/features
datasets_num_private_threads: Number of private threads for tf.data.
datasets_num_private_threads: Number of private threads for tf.data.
num_parallel_batches: Number of parallel batches for tf.data.
num_parallel_batches: Number of parallel batches for tf.data.
parse_record_fn: Function to use for parsing the records.
Returns:
Returns:
A dataset that can be used for iteration.
A dataset that can be used for iteration.
...
@@ -195,7 +196,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
...
@@ -195,7 +196,7 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
is_training
=
is_training
,
is_training
=
is_training
,
batch_size
=
batch_size
,
batch_size
=
batch_size
,
shuffle_buffer
=
_SHUFFLE_BUFFER
,
shuffle_buffer
=
_SHUFFLE_BUFFER
,
parse_record_fn
=
parse_record
,
parse_record_fn
=
parse_record
_fn
,
num_epochs
=
num_epochs
,
num_epochs
=
num_epochs
,
dtype
=
dtype
,
dtype
=
dtype
,
datasets_num_private_threads
=
datasets_num_private_threads
,
datasets_num_private_threads
=
datasets_num_private_threads
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment