Skip to content

Commit 5eea1c7

Browse files
authored
Merge pull request #41 from asmeurer/ci-fix
Use the main array-api-tests repo instead of my fork on CI
2 parents 2ec609d + 977fceb commit 5eea1c7

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.github/workflows/array-api-tests.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,9 @@ jobs:
4141
- name: Checkout array-api-tests
4242
uses: actions/checkout@v3
4343
with:
44-
# repository: data-apis/array-api-tests
44+
repository: data-apis/array-api-tests
4545
submodules: 'true'
4646
path: array-api-tests
47-
48-
# Temporarily use https://github.com/data-apis/array-api-tests/pull/157
49-
repository: asmeurer/array-api-tests
50-
ref: xfails-file
5147
- name: Set up Python ${{ matrix.python-version }}
5248
uses: actions/setup-python@v1
5349
with:

array_api_compat/common/_aliases.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def _asarray(
331331

332332
return xp.asarray(obj, dtype=dtype, **kwargs)
333333

334-
# xp.reshape calls the keyword argument 'newshape' instead of 'shape'
334+
# np.reshape calls the keyword argument 'newshape' instead of 'shape'
335335
def reshape(x: ndarray,
336336
/,
337337
shape: Tuple[int, ...],
@@ -340,8 +340,9 @@ def reshape(x: ndarray,
340340
if copy is True:
341341
x = x.copy()
342342
elif copy is False:
343-
x.shape = shape
344-
return x
343+
y = x.view()
344+
y.shape = shape
345+
return y
345346
return xp.reshape(x, shape, **kwargs)
346347

347348
# The descending keyword is new in sort and argsort, and 'kind' replaced with

array_api_compat/torch/_aliases.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,16 @@ def where(condition: array, x1: array, x2: array, /) -> array:
459459
x1, x2 = _fix_promotion(x1, x2)
460460
return torch.where(condition, x1, x2)
461461

462+
# torch.reshape doesn't have the copy keyword
463+
def reshape(x: array,
464+
/,
465+
shape: Tuple[int, ...],
466+
copy: Optional[bool] = None,
467+
**kwargs) -> array:
468+
if copy is not None:
469+
raise NotImplementedError("torch.reshape doesn't yet support the copy keyword")
470+
return torch.reshape(x, shape, **kwargs)
471+
462472
# torch.arange doesn't support returning empty arrays
463473
# (https://github.com/pytorch/pytorch/issues/70915), and doesn't support some
464474
# keyword argument combinations
@@ -659,8 +669,8 @@ def isdtype(
659669
'logaddexp', 'multiply', 'not_equal', 'pow', 'remainder',
660670
'subtract', 'max', 'min', 'sort', 'prod', 'sum', 'any', 'all',
661671
'mean', 'std', 'var', 'concat', 'squeeze', 'flip', 'roll',
662-
'nonzero', 'where', 'arange', 'eye', 'linspace', 'full', 'ones',
663-
'zeros', 'empty', 'tril', 'triu', 'expand_dims', 'astype',
672+
'nonzero', 'where', 'reshape', 'arange', 'eye', 'linspace', 'full',
673+
'ones', 'zeros', 'empty', 'tril', 'triu', 'expand_dims', 'astype',
664674
'broadcast_arrays', 'unique_all', 'unique_counts',
665675
'unique_inverse', 'unique_values', 'matmul', 'matrix_transpose',
666676
'vecdot', 'tensordot', 'isdtype']

0 commit comments

Comments
 (0)