Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: np.dot result changes based on shape when the input contains nan #27902

Copy link
Copy link
Open
@AnonymousPlayer2000

Description

@AnonymousPlayer2000
Issue body actions

Describe the issue:

np.dot result changes based on shape when the inputs containsnan

Reproduce the code example:

import numpy as np

print(np.dot(np.array([[np.nan]]), np.array(0.)))
print(np.dot(np.array([[np.nan, np.nan]]), np.array(0.)))

Error message:

[[nan]]
[[0. 0.]]

Python and NumPy Versions:

2.1.0
3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]

Runtime Environment:

[{'numpy_version': '2.1.0',
'python': '3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]',
'uname': uname_result(system='Linux', node='60a9b3769f7e', release='6.8.0-49-generic', version='#49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/usr/local/lib/python3.10/dist-packages/numpy.libs/libscipy_openblas64_-ff651d7f.so',
'internal_api': 'openblas',
'num_threads': 24,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.27'}]

Context for the issue:

This issue may be related to two previous issues in 2019:

  1. np.dot(0, inf) result changes based on shape
  2. BUG: Dot product does not check for floating point warning flags

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.