Skip to content

[OpenCL] Extended L2LossTest to GPU and SYCL - #54

Closed
jeffmak wants to merge 4 commits into
lukeiwanski:eigen_mehdifrom
jeffmak:opencltests/l2loss
Closed

jeffmak wants to merge 4 commits into
lukeiwanski:eigen_mehdifrom
jeffmak:opencltests/l2loss

Conversation

@jeffmak

@jeffmak jeffmak commented Jun 7, 2017

Copy link
Copy Markdown

No description provided.

@jeffmak jeffmak changed the title [OpenCL] Added SYCL test for L2Loss [OpenCL] Extended L2LossTest to GPU and SYCL Jun 7, 2017

@jwlawson jwlawson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix the assert in the for loop.
Using a test config pair is just a stylistic change and up to you.

Comment thread tensorflow/python/ops/nn_test.py Outdated
l2loss = nn_ops.l2_loss(x)
value = l2loss.eval()
self.assertAllClose(7.0, value)
for test_gpu in [ False, True ]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other tests I've seen a (type, use_gpu) pair used, either with a TestConfig helper function (like here ) or just using itertools.product (like here ). This then means you don't have to re-indent everything which minimises changes and helps to avoid errors like the one below.

Comment thread tensorflow/python/ops/nn_test.py Outdated
err = gradient_checker.compute_gradient_error(x, x_shape, output, [1])
print("L2Loss gradient err = %g " % err)
err_tolerance = 1e-11
self.assertLess(err, err_tolerance)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert needs to be in the for loop. Otherwise we are only testing one case.

@jwlawson jwlawson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are really picky comments, but try not to introduce changes if you can avoid it.

Comment thread tensorflow/python/ops/nn_test.py Outdated
with self.test_session(use_gpu=test_gpu):
x = constant_op.constant(
[1.0, 0.0, 3.0, 2.0], shape=[2, 2], name="x", dtype=dtype)
[1.0, 0.0, 3.0, 2.0], shape=[2, 2], name="x", dtype=dtype)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous 4 space indent is correct for line continuation.

Comment thread tensorflow/python/ops/nn_test.py Outdated
value = l2loss.eval()
self.assertAllClose(7.0, value)


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants