7 Commits

Author SHA1 Message Date
Tianqi Chen 9a8320acbd [LINT][PYTHON] Modernize annotations with ruff UP rules (#18830)
This PR enables ruff pyupgrade (UP) rules with py310 target, auto-fixing
~5600 annotation modernizations (PEP 585 generics, PEP 604 unions,
deprecated typing imports).

Also removes from __future__ import annotations from ir/module.py and
rmsnorm.py, bumps requires-python to >=3.10, and removes absolute_import
aliases from topi/contrib files.
2026-02-27 21:29:47 -05:00
Tianqi Chen 33dcea1686 [REFACTOR][LINT] Modernize ruff config (#18810)
This PR removes the extra lint violations from the codebase so lint
aligns with the latest style
2026-02-23 07:29:21 -05:00
Tianqi Chen aa2e609136 [LINT] Modernize lint to use pre-commit hooks (#18807)
This PR migrates existing lint to use pre-commit hooks
2026-02-22 11:03:21 -05:00
Krzysztof Parzyszek 48200fc3d7 [TOPI] Use f-strings for string formatting, NFC (#14822)
* [TOPI] Use f-strings for string formatting, NFC

Replace uses of % and .format() with f-strings.

* Format updated files
2023-05-11 16:13:10 +09:00
Krzysztof Parzyszek 4d7e890407 [testing] Use tuples for numpy indexing (#14476)
Some versions of numpy disallow the following:

>>> import numpy as np
>>> a = np.zeros(10)
>>> b = [slice(None)]
>>> a[b]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis
(`None`) and integer or boolean arrays are valid indices

When b is a tuple, it works fine:

>>> a[tuple(b)]
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
2023-04-03 18:13:21 -07:00
Mario Perić SiMa.ai 83ce7fe827 [TOPI] Fix nn.pool*d issue with 'vectorize' function and add unit tests (#8541)
* Fix issue in 'vectorize' function for 1D and 3D tensors

* Add pooling tests for channel last layouts

* Add support for more general layouts in "poolnd" implementation

* Reformat with 'black'

* Fix lint issues
2021-07-29 19:53:02 +09:00
AndrewZhaoLuo 38e0bbed7d [ONNX][TOPI][Relay]Support dilations in pooling operators (#7928)
* change more pooling operators

dilations -> dilation to match old field names in conv

fix python interface into new relay nodes

fix order of arguments

update type relation for dilations

change topi interface to use dilations

* spooky, there are two implementations! Change to 1 topi

use generic poolnd instead of 2d implementation for topi

remove old pooling topi

* rename pool --> pool2d in topi

change pool -> pool2d, make topi tests work now

make op level 2 pass with interface changes

fix dilation being hardcoded to 1

proper calculation for avgs among dilations

proper avg pool padding behavior

change name of pool test to pool2d test

* add poolnd baseline implementation

more fixes to edge cases for poolnd, delete old versions

replace topi tests with new baseline python version

clean up tests

make tests more readable kind of

add dilation topi tests FINALLY

remove see_pool.py

remove dilation from grad

* fix subtle implementation detail between topi and baseline python pool op

* rewrite tests to be more generic for relay pooling ops

add relay dilation tests, FINALLY

add some comments to testing code

linting and formatting

add ASF header

make 10/10 for black formatting lol

more appeasing the formatting gods

wow

add parameters to documentation

fix test import

Jostle CI

fix more broken unit tests using old version of pool

fix wrong var used for bound calc

add dilation to arm tests

add docstring to python make funcs

* fix pattern utils out of place args

* properly forward more tests to use dilations in pooling

formatting

more formatting

relax constraints on test to make it pass

relax more constraints

fix some pytorch frontend errors

fix error

better test conditions

jostle build

* fix padding bug with ceil mode

jostle build

cleaner pool condition

remove see_pool.py again

* add dilations field to onnx importer

blacking files

black file

* address matthew's comments
2021-05-04 10:24:21 -06:00