Commit Graph

14 Commits

Author SHA1 Message Date
Aaron Gokaslan
3fe437b24b [BE]: Update flake8 to v6.1.0 and fix lints (#116591)
Updates flake8 to v6.1.0 and fixes a few lints using sed and some ruff tooling.
- Replace `assert(0)` with `raise AssertionError()`
- Remove extraneous parenthesis i.e.
  - `assert(a == b)` -> `assert a == b`
  - `if(x > y or y < z):`->`if x > y or y < z:`
  - And `return('...')` -> `return '...'`

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/116591
Approved by: https://github.com/albanD, https://github.com/malfet
2024-01-03 06:04:44 +00:00
Aaron Gokaslan
660e8060ad [BE]: Update ruff to 0.285 (#107519)
This updates ruff to 0.285 which is faster, better, and have fixes a bunch of false negatives with regards to fstrings.

I also enabled RUF017 which looks for accidental quadratic list summation. Luckily, seems like there are no instances of it in our codebase, so enabling it so that it stays like that. :)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107519
Approved by: https://github.com/ezyang
2023-08-22 23:16:38 +00:00
PyTorch MergeBot
d59a6864fb Revert "[BE]: Update ruff to 0.285 (#107519)"
This reverts commit 88ab3e4322.

Reverted https://github.com/pytorch/pytorch/pull/107519 on behalf of https://github.com/ZainRizvi due to Sorry, but this PR breaks internal tests. @ezyang, can you please hep them get unblocked? It seems like one of the strings was prob accidentally modified ([comment](https://github.com/pytorch/pytorch/pull/107519#issuecomment-1688833480))
2023-08-22 19:53:32 +00:00
Aaron Gokaslan
88ab3e4322 [BE]: Update ruff to 0.285 (#107519)
This updates ruff to 0.285 which is faster, better, and have fixes a bunch of false negatives with regards to fstrings.

I also enabled RUF017 which looks for accidental quadratic list summation. Luckily, seems like there are no instances of it in our codebase, so enabling it so that it stays like that. :)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107519
Approved by: https://github.com/ezyang
2023-08-20 01:36:18 +00:00
Kurt Mohler
6af6b8f728 Reland: Remove set_default_dtype from nn tests (#107069)
Part of #68972
Relands #105775

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107069
Approved by: https://github.com/ezyang
2023-08-14 17:01:57 +00:00
PyTorch MergeBot
ec0f3fda7d Revert "Remove set_default_dtype from nn tests (#105775)"
This reverts commit 4d6a891baf.

Reverted https://github.com/pytorch/pytorch/pull/105775 on behalf of https://github.com/huydhn due to Sorry for reverting you change, it is failing one of the slow test in trunk ([comment](https://github.com/pytorch/pytorch/pull/105775#issuecomment-1675460195))
2023-08-11 22:14:17 +00:00
Kurt Mohler
4d6a891baf Remove set_default_dtype from nn tests (#105775)
Part of #68972

Pull Request resolved: https://github.com/pytorch/pytorch/pull/105775
Approved by: https://github.com/ezyang
2023-08-10 14:56:13 +00:00
Zafar
c967e7724e [quant] conv_transpose1d_prepack / conv_transpose1d_unpack (#40360)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/40360

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D22158982

Pulled By: z-a-f

fbshipit-source-id: 844d02806554aaa68b521283703e630cc544d419
2020-09-11 04:12:28 -07:00
Zafar
69e38828f5 [quant] conv_transpose2d_prepack/conv_transpose2d_unpack (#40351)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/40351

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D22158983

Pulled By: z-a-f

fbshipit-source-id: 3ca064c2d826609724b2740fcc9b9eb40556168d
2020-09-03 17:21:32 -07:00
Nikita Shulga
b29ec43555 Limit max numel for test tensors (#38304)
Summary:
Add `max_numel` option to `hypothesys_utils.array_shapes`
Use it to limit tensor element count to 100K for tensors whose maximum number of elements can exceed 250K
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38304

Differential Revision: D21525483

Pulled By: malfet

fbshipit-source-id: fac132dc7274b9417141b708cc9535561a95fcb3
2020-05-12 10:46:00 -07:00
Vasiliy Kuznetsov
b61fda2313 reenable quantized test_compare_tensor_scalar (#37422)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37422

The test was failing because in fbcode the version of hypothesis was too old to know
about the width parameter, and it was trying to generate values larger than float32.  The fix
is to explicitly set the defaults of the floats range for old versions of hypothesis.

For now, reenable the test and see what breaks in CI
ghstack-source-id: 103500358

Test Plan:
CI

```
buck test mode/dev-nosan //caffe2/test:quantization -- 'test_compare_tensor_scalar \(quantization\.test_quantized_op\.TestComparatorOps\)'
```

Imported from OSS

Reviewed By: raghuramank100

Differential Revision: D21310336

fbshipit-source-id: 1a59ab722daa28aab3d6d2d09bc527874942dc36
2020-05-05 16:09:08 -07:00
Jerry Zhang
54aac4af1f Update hypothesis_utils.py (#33739)
Summary:
A typo..
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33739

Differential Revision: D20088096

Pulled By: jerryzh168

fbshipit-source-id: d8b5d263c25f8c779698607be87bf76aca1811ab
2020-02-24 20:56:42 -08:00
Raghuraman Krishnamoorthi
0e29e9e0f6 Re-enable internal test runs
Summary:
Fix internal error message due to old version of hypothesis
   test_suite = self.load_tests()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/caffe2/test/quantization#binary,link-tree/__fb_test_main__.py", line 678, in load_tests
    suite = loader.load_all()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/caffe2/test/quantization#binary,link-tree/__fb_test_main__.py", line 467, in load_all
    __import__(module_name, level=0)
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/caffe2/test/quantization#binary,link-tree/test_quantization.py", line 45, in <module>
    hu.assert_deadline_disabled()
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/caffe2/test/quantization#binary,link-tree/torch/testing/_internal/hypothesis_utils.py", line 322, in assert_deadline_disabled
    assert settings().deadline is None
  File "/data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/buck-out/dev/gen/caffe2/test/quantization#binary,link-tree/hypothesis/_settings.py", line 127, in __getattr__
    raise AttributeError('settings has no attribute %s' % (name,))
AttributeError: settings has no attribute deadline

Test Plan: buck test mode/dev //caffe2/test:quantization -- --run-disabled runs successfully

Differential Revision: D19795232

fbshipit-source-id: ef1d8be20b4be30e1cfad4cd5019c4779a5f4568
2020-02-07 18:08:18 -08:00
Pritam Damania
f050b16dd9 Move pytorch distributed tests to separate folder for contbuild. (#30445)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30445

Create distributed and rpc directories under caffe/test for better management
of unit tests.

Differential Revision: D18702786

fbshipit-source-id: e9daeed0cfb846ef68806f6decfcb57c0e0e3606
2020-01-22 21:16:59 -08:00