several `torch` binary functions don't accept scalars for one argument

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, pytorch
領域
api

調査の方向性

まず、issue に示されている torch ベースの xp.minimum、xp.maximum、xp.copysign のエントリポイントから始め、スカラーの扱いを 2024.12 Array API standard と比較してください。関連する二項関数についても同じ不一致がないか確認してください。完了の条件は、報告されている TypeErrors が発生せず、どちらの位置でもスカラー引数が機能することです。

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

説明

blocked by upstream

Per the 2024.12 standard, these should work, but don't:

from array_api_compat import torch as xp
xp.minimum(xp.asarray(1), 2)  # TypeError: minimum(): argument 'other' (position 2) must be Tensor, not int
xp.minimum(2, xp.asarray(1))  # TypeError: minimum(): argument 'input' (position 1) must be Tensor, not int
xp.copysign(xp.asarray(1.), 2)  # OK
xp.copysign(2, xp.asarray(1.))
# TypeError: copysign() received an invalid combination of arguments - got (int, Tensor), but expected one of:
#  * (Tensor input, Tensor other, *, Tensor out = None)
#  * (Tensor input, Number other, *, Tensor out = None)

Looks like maximum also has trouble. Haven't checked the rest of the functions that now accept scalars, but I assume others may have trouble.

主要言語
Python
スター
131
フォーク
49
平均マージ
2日 8時間
マージ済み PR(30日)
6

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

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

はじめの一歩

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

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

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

似ている issue

Python の issue をもっと見る

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

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