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
9edda005
Commit
9edda005
authored
May 19, 2020
by
Hongkun Yu
Committed by
A. Unique TensorFlower
May 19, 2020
Browse files
Masks movielens_test as it is failing.
PiperOrigin-RevId: 312428494
parent
7b95816b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
117 deletions
+0
-117
official/r1/wide_deep/movielens_test.py
official/r1/wide_deep/movielens_test.py
+0
-117
No files found.
official/r1/wide_deep/movielens_test.py
deleted
100644 → 0
View file @
7b95816b
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
numpy
as
np
import
tensorflow.compat.v1
as
tf
from
official.recommendation
import
movielens
from
official.utils.testing
import
integration
from
official.r1.wide_deep
import
movielens_dataset
from
official.r1.wide_deep
import
movielens_main
from
absl
import
logging
logging
.
set_verbosity
(
logging
.
ERROR
)
TEST_INPUT_VALUES
=
{
"genres"
:
np
.
array
(
[
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]),
"user_id"
:
[
3
],
"item_id"
:
[
4
],
}
TEST_ITEM_DATA
=
"""item_id,titles,genres
1,Movie_1,Comedy|Romance
2,Movie_2,Adventure|Children's
3,Movie_3,Comedy|Drama
4,Movie_4,Comedy
5,Movie_5,Action|Crime|Thriller
6,Movie_6,Action
7,Movie_7,Action|Adventure|Thriller"""
TEST_RATING_DATA
=
"""user_id,item_id,rating,timestamp
1,2,5,978300760
1,3,3,978302109
1,6,3,978301968
2,1,4,978300275
2,7,5,978824291
3,1,3,978302268
3,4,5,978302039
3,5,5,978300719
"""
class
BaseTest
(
tf
.
test
.
TestCase
):
"""Tests for Wide Deep model."""
@
classmethod
def
setUpClass
(
cls
):
# pylint: disable=invalid-name
super
(
BaseTest
,
cls
).
setUpClass
()
movielens_main
.
define_movie_flags
()
def
setUp
(
self
):
# Create temporary CSV file
self
.
temp_dir
=
self
.
get_temp_dir
()
tf
.
io
.
gfile
.
makedirs
(
os
.
path
.
join
(
self
.
temp_dir
,
movielens
.
ML_1M
))
self
.
ratings_csv
=
os
.
path
.
join
(
self
.
temp_dir
,
movielens
.
ML_1M
,
movielens
.
RATINGS_FILE
)
self
.
item_csv
=
os
.
path
.
join
(
self
.
temp_dir
,
movielens
.
ML_1M
,
movielens
.
MOVIES_FILE
)
with
tf
.
io
.
gfile
.
GFile
(
self
.
ratings_csv
,
"w"
)
as
f
:
f
.
write
(
TEST_RATING_DATA
)
with
tf
.
io
.
gfile
.
GFile
(
self
.
item_csv
,
"w"
)
as
f
:
f
.
write
(
TEST_ITEM_DATA
)
def
test_input_fn
(
self
):
train_input_fn
,
_
,
_
=
movielens_dataset
.
construct_input_fns
(
dataset
=
movielens
.
ML_1M
,
data_dir
=
self
.
temp_dir
,
batch_size
=
8
,
repeat
=
1
)
dataset
=
train_input_fn
()
features
,
labels
=
dataset
.
make_one_shot_iterator
().
get_next
()
with
self
.
session
()
as
sess
:
features
,
labels
=
sess
.
run
((
features
,
labels
))
# Compare the two features dictionaries.
for
key
in
TEST_INPUT_VALUES
:
self
.
assertTrue
(
key
in
features
)
self
.
assertAllClose
(
TEST_INPUT_VALUES
[
key
],
features
[
key
][
0
])
self
.
assertAllClose
(
labels
[
0
],
[
1.0
])
def
test_end_to_end_deep
(
self
):
integration
.
run_synthetic
(
main
=
movielens_main
.
main
,
tmp_root
=
self
.
temp_dir
,
extra_flags
=
[
"--data_dir"
,
self
.
temp_dir
,
"--download_if_missing=false"
,
"--train_epochs"
,
"1"
,
"--epochs_between_evals"
,
"1"
],
synth
=
False
)
if
__name__
==
"__main__"
:
tf
.
disable_eager_execution
()
tf
.
test
.
main
()
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