Skip to content

Strange test_linspace assertion errors in jax #153

Description

@simonetgordon

Hi there,

test_linspace is failing for the jax backend for ivy, and hypothesis picks up two distinct failures:

  1. AssertionError: out[0]=ivy.array(nan), but should be 9.9792015476736e+291 [linspace(9.9792015476736e+291, -1.7976931348623157e+308, 2)]
  • raised on line
  • Falsifying example: linspace(9.9792015476736e+291, -1.7976931348623157e+308, num =2, dtype= 'float64', endpoint=False)
  • The output for the same inputs in numpy is: ivy.array([[ nan, -inf]]) (i.e. out[0] = nan, the same as in jax)
  1. AssertionError: out[0]=ivy.array(9.97920155e+291), should be ivy.array(nan) [linspace()]
  • raised on line: ph.assert_array_elements("linspace", out, expected)
  • Falsifying example: linspace(9.9792015476736e+291, -1.7976931348623157e+308, num =1, dtype= 'float64', endpoint=False)
  • The output for the same inputs in numpy is: ivy.array([[ nan]]) (i.e. out[0] = nan, different from the jax output)

I went about fixing the second failure as jax was diverging from numpy. However, I then (locally) got:
AssertionError: out[0]=ivy.array(nan), but should be 9.9792015476736e+291 [linspace(9.9792015476736e+291, -1.7976931348623157e+308, 1)].

Summary: the expected value for linspace seems to vary from the numpy value when start=9.9792015476736e+291 and stop= -1.7976931348623157e+308 (close to float64 min value) with num=1/2, causing the test to fail for jax.

I can't reproduce these inputs for numpy test_linspace, so it is unclear if it would also fail for numpy or any other backend - jax is the only one that has raised this issue.

Reference stack trace from ivy CI (click Run Array API Tests'

Activity

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