Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Missing use cases for binops on array vs. scalar

オープン
#364 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
testing-qa

調査の方向性

array_api_tests/hypothesis_helpers.py の参照されているセクションから始め、次に test_operators_and_elementwise_functions.py の test_binary_with_scalars_real と test_special_cases.py の test_binary を調べます。生成された入力を、列挙されている整数、特殊値、範囲外のスカラーのケースと比較します。不足しているケースがカバーされ、float/complex の範囲の挙動が明確になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

After reading hh.scalars, I understand that array-api-tests currently never generates the use cases of a binop where one argument is an Array with float or complex dtype and the other argument is

  • a pure-python integer;
  • a scalar inf, -inf, or nan;
  • a scalar outside of the range [1/64, 64]

Unless I missed something and the tests for these cases are somewhere else?

https://github.com/data-apis/array-api-tests/blob/c1e5cda7836963e58e40bcdf68881a569b8c64d5/array_api_tests/hypothesis_helpers.py#L451-L481

https://github.com/data-apis/array-api-tests/blob/c1e5cda7836963e58e40bcdf68881a569b8c64d5/array_api_tests/hypothesis_helpers.py#L590-L597

Note that the [1/64, 64] range exclusively applies to float/complex. The code could use a clarification there as it is not obvious upon first read that integers ignore it.

e.g. pytest -k minimum returns this:

array_api_tests/test_has_names.py::test_has_names[elementwise-minimum] PASSED                                                                                    [ 20%]
array_api_tests/test_operators_and_elementwise_functions.py::test_minimum PASSED                                                                                 [ 40%]
array_api_tests/test_operators_and_elementwise_functions.py::test_binary_with_scalars_real[minimum] SKIPPED (requires ARRAY_API_TESTS_VERSION >= 2024.12)        [ 60%]
array_api_tests/test_signatures.py::test_func_signature[minimum] PASSED                                                                                          [ 80%]
array_api_tests/test_special_cases.py::test_binary[minimum(x1_i is NaN or x2_i is NaN) -> NaN] PASSED   

To my understanding

  • in test_binary_with_scalars_real, when one arg is Array[float64] or Array[float32], the other arg is always in the [1/64, 64] range;
  • test_special_cases::test_binary only tests arrays containing NaN, not scalar NaN;
  • none tests inf or arrays containing inf

related:

主要言語
Python
スター
74
フォーク
54
平均マージ
4時間 35分
マージ済み PR(30日)
4

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

data-apis/array-api-tests のほかの issue

data-apis/array-api-tests の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。