Skip to content

Incorrect predicate application in EagerTestSession and GraphTestSession #223

Open

Description

@deansher

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?

Activity

  1. JimClarke5 commented on Feb 20, 2021

    @JimClarke5
    Contributor

    Where are you seeing this? I cannot find it in TestSession, EagerTestSession or GraphTestSession.
    It may have been something I already fixed when I refactored TestSession a few PRs ago.

    The closest I can find to the above is:
    TestSession: 1089-1093 in my copy.

      if (isScalar) {
          assertTrue(predicate.test(tensor.getObject()));
        } else {
          tensor.scalars().forEachIndexed((idx, s) -> assertTrue(predicate.test(s.getObject())));
        }
    
  2. deansher commented on Feb 26, 2021

    @deansher
    ContributorAuthor
  3. deansher commented on Feb 26, 2021

    @deansher
    ContributorAuthor
  4. JimClarke5 commented on Feb 26, 2021

    @JimClarke5
    Contributor

    I have dramatically refactored all this, maybe my version hasn't been pushed yet.
    I know the refactor is in my Layers1 branch (not pushed). I'll check Metrics2, #222, branch to see if it is in there.

  5. JimClarke5 commented on Mar 17, 2021

    @JimClarke5
    Contributor

    The refactor is in Layers1, not yet pushed. I am ready to push this, but have been holding off for other PR's to be approved first.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions