tensorflow / tensorflow/java

Incorrect predicate application in EagerTestSession and GraphTestSession

Open
#223 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
928
Forks
227
PR merge metrics
No merged PRs in 30d

Description

I believe this is a widespread broken pattern in EagerTestSession and GraphTestSession:

        o.asTensor()
            .scalars()
            .forEachIndexed((idx, f) -> assertTrue(predicate.test(o.asTensor().getFloat())));

Notice that f is ignored in the lambda, and o is referenced directly instead. getFloat then returns the zero'th element of the tensor.

@JimClarke5, am I right here?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the EagerTestSession and GraphTestSession classes for assertions matching the shown forEachIndexed pattern. Check whether each predicate is applied to the iterated scalar rather than the tensor's default element, then verify that all affected assertions use the intended value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.