Commit Graph

3024 Commits

Author SHA1 Message Date
Jaromir Latal
6e2c14a0e8 [Codemod][[codemod] Replace third-party mock with unittest.mock] caffe2/caffe2 (#106541)
Reviewed By: thechrisu

Differential Revision: D47909974

Pull Request resolved: https://github.com/pytorch/pytorch/pull/106541
Approved by: https://github.com/thechrisu
2023-09-29 18:09:49 +00:00
cyy
ac603bc2f8 [Reland] Eliminate invocations of c10::stoi,c10::stod,c10::stoull,c10::stoll (#109566)
This is reland of #87603 with definitions of c10::stoXX kept for further investigation.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/109566
Approved by: https://github.com/huydhn
2023-09-19 07:15:25 +00:00
PyTorch MergeBot
4d44d8c00a Revert "Eliminate c10::stoi,c10::stod,c10::stoull,c10::stoll (#109179)"
This reverts commit 852f1b8417.

Reverted https://github.com/pytorch/pytorch/pull/109179 on behalf of https://github.com/huydhn due to Sorry for reverting your change but this is breaking periodic buck build, so please fix the issue and reland the change https://github.com/pytorch/pytorch/actions/runs/6207458526/job/16852695272 ([comment](https://github.com/pytorch/pytorch/pull/109179#issuecomment-1724168571))
2023-09-18 18:41:12 +00:00
Aaron Gokaslan
6d725e7d66 [BE]: enable ruff rules PLR1722 and PLW3301 (#109461)
Enables two ruff rules derived from pylint:
* PLR1722 replaces any exit() calls with sys.exit(). exit() is only designed to be used in repl contexts as may not always be imported by default. This always use the version in the sys module which is better
* PLW3301 replaces nested min / max calls with simplified versions (ie. `min(a, min(b, c))` => `min(a, b. c)`). The new version is more idiomatic and more efficient.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/109461
Approved by: https://github.com/ezyang
2023-09-18 02:07:21 +00:00
cyy
852f1b8417 Eliminate c10::stoi,c10::stod,c10::stoull,c10::stoll (#109179)
We can remove these functions in favor of std ones.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109179
Approved by: https://github.com/colesbury
2023-09-16 07:22:50 +00:00
Jeffrey Dunn
25d657c701 Fix possible naming collision issue (#107743)
Summary: As pointed out in https://github.com/pytorch/pytorch/pull/107479, using a set prevents collisions like "a" => "a", "a" => "a_1", "a_1" => "a_1" (but should go to "a_1_1"). We can combine using counters and a set to avoid this problem. Still gets us the performance benefit in the case of collisions with a very minor penalty in a case with no collision.

Test Plan:
Extract this code and run:
```
# New version
from typing import Dict, Set

class Net:
    _net_names_used_counters: Dict[str, int] = {}
    _net_names_used: Set[str] = set()

    staticmethod
    def current_prefix():
        return "test_prefix"

    staticmethod
    def _get_next_net_name(basename):
        basename = "/".join(x for x in [Net.current_prefix(), basename] if x)
        idx = Net._net_names_used_counters.get(basename, 0)
        while (name := basename if idx == 0 else f"{basename}_{idx}") in Net._net_names_used:
            idx += 1
        Net._net_names_used_counters[basename] = idx + 1
        Net._net_names_used.add(name)
        return name

print(Net._get_next_net_name("basename"))
print(Net._get_next_net_name("x_basename"))
print(Net._get_next_net_name("basename"))
print(Net._get_next_net_name("basename"))
print(Net._get_next_net_name("x_basename"))
print(Net._get_next_net_name("basename_1"))

> test_prefix/basename
> test_prefix/x_basename
> test_prefix/basename_1
> test_prefix/basename_2
> test_prefix/x_basename_1
> test_prefix/basename_1_1
```

Differential Revision: D48576516

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107743
Approved by: https://github.com/zdevito
2023-09-08 17:39:27 +00:00
Jeffrey Dunn
1e9b590df9 Optimize Net._get_next_net_name (#107479)
Summary: This is surprisingly expensive and can be easily optimized.

Differential Revision: D48440000

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107479
Approved by: https://github.com/kit1980
2023-08-22 19:15:11 +00:00
Aaron Gokaslan
b1e8e01e50 [BE]: Apply PYI autofixes to various types (#107521)
Applies some autofixes from the ruff PYI rules to improve the typing of PyTorch. I haven't enabled most of these ruff rules yet as they do not have autofixes.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107521
Approved by: https://github.com/ezyang
2023-08-20 02:42:21 +00:00
Yun Wang (Speech)
0d57e87000 Fix test_div in caffe2/caffe2/python:hypothesis_test (#106694)
Summary: Suppress the "too_slow" health check for `test_div`.

Test Plan: Sandcastle

Differential Revision: D48105842

Pull Request resolved: https://github.com/pytorch/pytorch/pull/106694
Approved by: https://github.com/malfet
2023-08-08 04:50:21 +00:00
Omkar Salpekar
ae1ed27756 [codemod][numpy] replace np.str with str (#103931)
Summary:
`np.str` is removed from numpy 1.20.0. It was an alias to builtin `str` and it's safe to do the replacement.

The whole changes is mechanical, generated using the following onliner:
```
fbgr -sl 'np\.str\b' | xargs perl -pi -e 's,\bnp\.str\b,str,g'
```

Test Plan: sandcastle

Differential Revision: D46586144

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103931
Approved by: https://github.com/huydhn
2023-06-21 18:16:42 +00:00
Aaron Gokaslan
616208b4fe [BE]: Cleanup deprecated stdlib imports (UP006,UP035) (#101361)
Automated fix to cleanup some deprecated/useless python imports.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101361
Approved by: https://github.com/zou3519
2023-05-15 14:32:41 +00:00
Aaron Gokaslan
8769fb854d [BE] Fix flake8 B027 errors - missing abstractmethod decorator (#100715)
Enables B027 and applies fixes by adding abstract method decorators. Autofix generated by ruff master.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100715
Approved by: https://github.com/ezyang
2023-05-09 17:28:48 +00:00
Sergii Dymchenko
c2402a9257 Change caffe2 branch links to main (#100129)
Just a change

pytorch/tree/master -> pytorch/tree/main
pytorch/blob/master -> pytorch/blob/main
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100129
Approved by: https://github.com/huydhn
2023-04-27 10:31:50 +00:00
Serkan Karakulak
deec8bd522 [fix] Disable EMA if ema_alpha is set to None (#98992)
Summary: changing the condition to enable ema updates in training, and disable it if the "ema_alpha" value is None

Test Plan: f427638974

Differential Revision: D44937126

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98992
Approved by: https://github.com/msaroufim
2023-04-18 17:28:07 +00:00
Yun Wang (Speech)
4130e4f284 [hypothesis==6.70.1] Fix more test errors (#98685)
Summary:
This diff fixes more test failures (T150117218) caused by upgrading the "hypothesis" library to 6.70.1 (D44523679).

# //caffe2/caffe2/python:hypothesis_test
This test generates float numbers and filters out those whose absolute values are less than 1e-2.
It is a known issue of the new version of "hypothesis" that it generates zeros or floats with small absolute values too often:
https://github.com/HypothesisWorks/hypothesis/issues/3603
I'm circumventing this issue by suppressing the health check `filter_too_much`.

# //caffe2/caffe2/quantization/server:resize_nearest_dnnlowp_op_test
All arithmetic should be done in float32 when calculating the reference, since the network being tested uses float32 everywhere.
Mixing float32, float64 or even integers will result in intermediate values in float64.
The different precision may cause off-by-1 errors when converting to integer.

Test Plan:
Run all the tests in both "dev" and "opt" modes:
```
for mode in dev opt; do
  buck2 test mode/$mode //caffe2/caffe2/python:hypothesis_test -- --run-disabled
  buck2 test mode/$mode //caffe2/caffe2/quantization/server:resize_nearest_dnnlowp_op_test -- --run-disabled
  buck2 test mode/$mode //caffe2/caffe2/fb/layers/tests:tum_history_test -- --run-disabled
  buck2 test mode/$mode //caffe2/caffe2/fb/dper/layer_models/tests:nn_ops_test -- --run-disabled
  buck2 test mode/$mode //caffe2/caffe2/fb/metrics:metrics_test -- --run-disabled
  buck2 test mode/$mode //deeplearning/numeric_suite/toolkit/test:net_transform_test -- --run-disabled
  buck2 test mode/$mode //f3/type_system:tests -- --run-disabled
done
```

**NOTE:** In the first test (`//caffe2/caffe2/python:hypothesis_test`), the two methods `test_constant_fill_from_tensor` and `test_recurrent` would crash.
But these crash on hypothesis 5.49.0, too, so I'm leaving them alone.

Differential Revision: D44812706

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98685
Approved by: https://github.com/malfet
2023-04-11 19:07:55 +00:00
Yun Wang (Speech)
ba6bc5080f Fix fused_8bit_rowwise_conversion_ops_test (#98183)
Summary:
This test tests an operator that quantizes and serializes a float array.
Among the data serialized, one element is the bias, i.e. the minimum value in the array.

The test may fail when the array contains both +0.0 and -0.0, while all other elements are positive.
(this happens quite frequently with a hypothesis version >= 6.17.4, due to [this issue](https://github.com/HypothesisWorks/hypothesis/issues/3606))
Depending on the exact settings of SIMD (single instruction, multiple data), the elements of the array may be visited in different orders while running the operator and while calculating the reference.
Because +0.0 and -0.0 compare equal, the minimum value may be either +0.0 or -0.0.
Nevertheless, the serialized forms of these two values differ in the sign bit, and can make the test fail because it's conducting an exact match on the serialized result.

To avoid this failure, I'm adding a line to replace all -0.0 with +0.0 in the input array.

Test Plan:
Run this with both hypothesis < 6.17.4 and >= 6.17.4:
```
buck2 test mode/opt caffe2/caffe2/python:fused_8bit_rowwise_conversion_ops_test - test_quantize_op
```

Differential Revision: D44617022

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98183
Approved by: https://github.com/malfet
2023-04-04 16:06:13 +00:00
Yu, Guangye
53c9bc8c68 Add DLPack support for XPU backend by mapping to kDLOneAPI in DLPack … (#94968)
# Motivation
The DLPack device type kDLOneAPI stands for the Unified Shared Memory allocated on a oneAPI device. The corresponding Pytorch backend type is XPU.
Support to export/import the Pytorch XPU tensor as a DLPack tensor of kDLOneAPI device.

# Solution
1. Update the DLPack protocol to v0.7.
2. Add the XPU hooks to map the Aten device and DLPack device with the address value and device information.

# Additional Context
Reopen (#82867)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94968
Approved by: https://github.com/kit1980
2023-03-30 04:32:15 +00:00
mikey dagitses
82592f7e53 remove dead torch_pb.h library (#97599)
This is only used in one place, ensure it still builds.

Differential Revision: [D44395699](https://our.internmc.facebook.com/intern/diff/D44395699/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D44395699/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97599
Approved by: https://github.com/PaliC
2023-03-28 00:55:17 +00:00
mikey dagitses
5d33596c5f remove dead proto_convert library (#97598)
This has no code, only a collection of headers. Just make sure the
only thing that includes it still builds.

Differential Revision: [D44395700](https://our.internmc.facebook.com/intern/diff/D44395700/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D44395700/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97598
Approved by: https://github.com/PaliC
2023-03-27 21:19:29 +00:00
PyTorch MergeBot
5170995b2a Revert "Upgrade NVTX to NVTX3 (#90689)"
This reverts commit e64ddd1ab9.

Reverted https://github.com/pytorch/pytorch/pull/90689 on behalf of https://github.com/osalpekar due to Build Failures due to not being able to find one nvtx3 header in FRL jobs: [D42332540](https://www.internalfb.com/diff/D42332540)
2023-03-24 18:16:06 +00:00
PyTorch MergeBot
13fbf93238 Revert "remove dead proto_convert library (#97322)"
This reverts commit d850c33bfe.

Reverted https://github.com/pytorch/pytorch/pull/97322 on behalf of https://github.com/osalpekar due to This broke a large number of internal builds due to not being able to find proto_convert.h. See here: [D44319486](https://www.internalfb.com/diff/D44319486)
2023-03-23 21:38:01 +00:00
cyy
e64ddd1ab9 Upgrade NVTX to NVTX3 (#90689)
Due to recent upgrade to CUDA 11, we can upgrade NVTX to NVTX3 as well, which is a header only library that can simplify the building system a lot.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/90689
Approved by: https://github.com/soumith, https://github.com/malfet
2023-03-23 01:56:42 +00:00
mikey dagitses
d850c33bfe remove dead proto_convert library (#97322)
remove dead proto_convert library

Summary:
This has no code, only a collection of headers. Just make sure the
only thing that includes it still builds.

Test Plan: Rely on CI.

Reviewers: sahanp

Subscribers:

Tasks:

Tags:

---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/pytorch/pytorch/pull/97322).
* #97337
* #97336
* #97335
* #97334
* #97325
* #97324
* #97323
* __->__ #97322
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97322
Approved by: https://github.com/malfet
2023-03-22 14:40:31 +00:00
Aaron Gokaslan
dd5e6e8553 [BE]: Merge startswith calls - rule PIE810 (#96754)
Merges startswith, endswith calls to into a single call that feeds in a tuple. Not only are these calls more readable, but it will be more efficient as it iterates through each string only once.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96754
Approved by: https://github.com/ezyang
2023-03-14 22:05:20 +00:00
Horace He
5bbec680d7 Fix usages of contextmanager without finally (#96170)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96170
Approved by: https://github.com/ngimel, https://github.com/malfet
2023-03-08 20:59:27 +00:00
Lei Zuo
3f381473cd [blob inspector] free memory from workspace for di blobs post stats (#95064)
Differential Revision: D43250357

Pull Request resolved: https://github.com/pytorch/pytorch/pull/95064
Approved by: https://github.com/michaelay
2023-02-19 05:05:35 +00:00
Xuehai Pan
8d45f555d7 [BE] [1/3] Rewrite super() calls in caffe2 and benchmarks (#94587)
Rewrite Python built-in class `super()` calls. Only non-semantic changes should be applied.

- #94587
- #94588
- #94592

Also, methods with only a `super()` call are removed:

```diff
class MyModule(nn.Module):
-   def __init__(self):
-       super().__init__()
-
    def forward(self, ...):
        ...
```

Some cases that change the semantics should be kept unchanged. E.g.:

f152a79be9/caffe2/python/net_printer.py (L184-L190)

f152a79be9/test/test_jit_fuser_te.py (L2628-L2635)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94587
Approved by: https://github.com/ezyang
2023-02-11 18:19:48 +00:00
Thiago Crepaldi
73bf32cb57 Bump to stable ONNX 1.13.0 (#90332)
ONNX had mismatch checker usage between cpp and python and it's later fixed by https://github.com/onnx/onnx/pull/4386. And since `torch.onnx.export` is using cpp checker for graph-level check with older version of ONNX,this improvement should be added. Also, this version bump enables #83186

Updated 12/5/2022:
This PR includes ONNX 1.13.0 release (https://github.com/onnx/onnx/tree/rel-1.13.0)

For [CVE-2022-25882](https://nvd.nist.gov/vuln/detail/CVE-2022-25882)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90332
Approved by: https://github.com/kit1980, https://github.com/malfet
2023-02-08 11:49:06 +00:00
Aaron Gokaslan
8fce9a09cd [BE]: pyupgrade Python to 3.8 - imports and object inheritance only (#94308)
Apply parts of pyupgrade to torch (starting with the safest changes).
This PR only does two things: removes the need to inherit from object and removes unused future imports.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94308
Approved by: https://github.com/ezyang, https://github.com/albanD
2023-02-07 21:10:56 +00:00
Aaron Gokaslan
748bac8757 [BE]: Apply pyupgrade yield from and unit test alias upgrades (#94309)
Applies some more harmless pyupgrades. This one gets rid of deprecated aliases in unit_tests and more upgrades yield for loops into yield from generators which are more performance and propagates more information / exceptions from original generator. This is the modern recommended way of forwarding generators.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94309
Approved by: https://github.com/albanD
2023-02-07 20:08:58 +00:00
Nikita Shulga
fde220ca44 [BE] Get rid of six in caffe2 code (#93956)
Mostly `s/string_types/str/` `s/binary_types/bytes/` and `s/text_types/str/`
Also `y.extend([str(x) for x in foo])`->`y.extend(map(str, foo))`
As Python-2 is long dead

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93956
Approved by: https://github.com/albanD, https://github.com/Skylion007
2023-02-02 22:13:37 +00:00
Nikita Shulga
5976f0bdfe Set min supported Python version to 3.8 (#93155)
Also, grep for `if sys.version_info .cond. (3, 8)` and replaces them with appropriate action.

This is a last in a series of PRs that moved CI/CD away from testing PyTorch behavior against Python-3.7.

Fixes https://github.com/pytorch/pytorch/issues/80513

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93155
Approved by: https://github.com/huydhn
2023-01-29 18:28:46 +00:00
Loren Arthur
0a57a20c02 [caffe2] Fix pybind11 native python link error (#92325)
Summary:
Currently, we define some C++ functions in one C++ Python extension
which are used by another.  This happens to work, but isn't guaranteed to.
This diff moves these functions to a separate C++ library rule to fix this.

Test Plan: CI

Differential Revision: D42552515

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92325
Approved by: https://github.com/kit1980, https://github.com/Skylion007
2023-01-26 02:33:17 +00:00
Serkan Karakulak
52e8af57a6 [3/N] Update ema_teacher_arch in the backward call (#92080)
Summary: adding support for updating ema_teacher_arch in C2 backend

Test Plan:
baseline
f397096610

EMA run
f397096864

Differential Revision: D41124891

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92080
Approved by: https://github.com/kit1980
2023-01-20 02:29:42 +00:00
Nikita Shulga
1906eaf22f [BE] Get rid of future (#92596)
PyTorch has been Python-3.X+ for ages, so it's a shame to still rely on `future.utils` even in a deprecated Caffe2 codebase

For the reference:
https://peps.python.org/pep-0469/#migrating-directly-to-python-3

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92596
Approved by: https://github.com/kit1980, https://github.com/orionr
2023-01-19 08:46:50 +00:00
Natalia Gimelshein
818079dc4e disabled flaky c2 test (#91640)
Summary: disables flaky test, T93236537

Test Plan: Existing tests

Differential Revision: D42314944

Pull Request resolved: https://github.com/pytorch/pytorch/pull/91640
Approved by: https://github.com/malfet
2023-01-03 21:26:21 +00:00
Sergii Dymchenko
f51f6aa387 Fix non-existing parameters in docstrings (#90505)
Continuation after https://github.com/pytorch/pytorch/pull/90163.

Here is a script I used to find all the non-existing arguments in the docstrings (the script can give false positives in presence of *args/**kwargs or decorators):

_Edit:_
I've realized that the indentation is wrong for the last `break` in the script, so the script only gives output for a function if the first docstring argument is wrong. I'll create a separate PR if I find more issues with corrected script.

``` python
import ast
import os
import docstring_parser

for root, dirs, files in os.walk('.'):
    for name in files:
        if root.startswith("./.git/") or root.startswith("./third_party/"):
            continue
        if name.endswith(".py"):
            full_name = os.path.join(root, name)
            with open(full_name, "r") as source:
                tree = ast.parse(source.read())
                for node in ast.walk(tree):
                    if isinstance(node, ast.FunctionDef):
                        all_node_args = node.args.args
                        if node.args.vararg is not None:
                            all_node_args.append(node.args.vararg)
                        if node.args.kwarg is not None:
                            all_node_args.append(node.args.kwarg)
                        if node.args.posonlyargs is not None:
                            all_node_args.extend(node.args.posonlyargs)
                        if node.args.kwonlyargs is not None:
                            all_node_args.extend(node.args.kwonlyargs)
                        args = [a.arg for a in all_node_args]
                        docstring = docstring_parser.parse(ast.get_docstring(node))
                        doc_args = [a.arg_name for a in docstring.params]
                        clean_doc_args = []
                        for a in doc_args:
                            clean_a = ""
                            for c in a.split()[0]:
                                if c.isalnum() or c == '_':
                                    clean_a += c
                            if clean_a:
                                clean_doc_args.append(clean_a)
                        doc_args = clean_doc_args
                        for a in doc_args:
                            if a not in args:
                                print(full_name, node.lineno, args, doc_args)
                            break

```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90505
Approved by: https://github.com/malfet, https://github.com/ZainRizvi
2022-12-09 21:43:09 +00:00
Ram Rachum
351d73b97f Fix exception causes all over the codebase (#90271)
This is the continuation to #90134 and hopefully the final PR in this series.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/90271
Approved by: https://github.com/kit1980
2022-12-07 04:29:00 +00:00
Atul Jangra
564905c8e1 [Caffe2] Fix the assert message (#89816)
Summary:
As title.
dev1/2 is invalid. It should be dev_1/2 instead

Test Plan: Sandcastle

Differential Revision: D41569982

Pull Request resolved: https://github.com/pytorch/pytorch/pull/89816
Approved by: https://github.com/PaliC
2022-12-05 23:40:08 +00:00
Aaron Gokaslan
54fca6a9da Fix: prefer .is_none() over .is(py::none()) for pybind11 in caffe2 (#88199)
Follow up to #88051 . I noticed that I missed a few spots in the caffe2 folder. Prefer `.is_none()` over `.is(py::none())` as `.is_none()` is more efficient since it avoid reference counting increments and decrements.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88199
Approved by: https://github.com/albanD, https://github.com/kit1980
2022-11-17 05:01:11 +00:00
mikey dagitses
3150c9dc6f extract out the clean workspace test to its own file (#88682)
Summary:
This test relies on what the root workspace is before any other code
is run. However, some of the test cases change it. If the order the
tests are run is randomized, then the test can fail if run after one
of them.

Having it on its own ensures that it always sees a pristine state.

Test Plan:
Verified locally and confirmed in internal and external CI.

Reviewers:

Subscribers:

Tasks:

Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88682
Approved by: https://github.com/r-barnes, https://github.com/malfet
2022-11-09 13:48:57 +00:00
PyTorch MergeBot
8c1c6759b2 Revert "remove assert_allclose from torch.testing (#87974)"
This reverts commit 5669e10d37.

Reverted https://github.com/pytorch/pytorch/pull/87974 on behalf of https://github.com/mehtanirav due to Internal breakages from method removal
2022-11-04 19:12:37 +00:00
Philip Meier
5669e10d37 remove assert_allclose from torch.testing (#87974)
See #87969 or #86586 for the reasoning.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87974
Approved by: https://github.com/mruberry
2022-11-02 14:05:01 +00:00
Philip Meier
bc73affdad prepare removal of deprecated functionality in torch.testing (#87969)
_Redo of #86586 with all BC breaking changes granularly placed into separate commits._

---

Per title. Deprecation happened on Feb 25, 2022 in c6f1bbc0ac, which made it into the 1.12 release. Since it is now 245 days later and the next release will be 1.14, the removals later in the stack comply with the [BC policy](https://github.com/pytorch/pytorch/wiki/PyTorch's-Python-Frontend-Backward-and-Forward-Compatibility-Policy#minimizing-the-disruption-of-bc-breaking-changes).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87969
Approved by: https://github.com/mruberry
2022-11-02 14:04:48 +00:00
Loren Arthur
1dad051b05 Move workspace related functions to separate file (#87651)
Move workspace related functions to separate file

Test Plan: Existing tests

Differential Revision: D40657708

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87651
Approved by: https://github.com/malfet
2022-10-29 04:52:01 +00:00
Kazuaki Ishizaki
daff5d3556 Fix typos under caffe2 directory (#87840)
This PR fixes typos in `.md` files under caffe2 directory

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87840
Approved by: https://github.com/kit1980
2022-10-28 04:53:36 +00:00
Wenguang Mao
755b39ba66 [LRD] Allowing using dedicated iteration counter for learning rate (#85195)
Summary: So that we could manipulate the iteration counter for lrarning rate separately (for learning rate decay or learning rate re-warming up etc), without affecting other techniques relying on iterations (such as EMA)

Test Plan:
Unit tests:
```
    ✓ Pass: caffe2/caffe2/python:optimizer_test - testSparse (caffe2.caffe2.python.optimizer_test.TestAdagradWithDedicatedLRIteration) (46.475)
    ✓ Pass: caffe2/caffe2/python:optimizer_test - test_global_norm_based_gradient_clipping (caffe2.caffe2.python.optimizer_test.TestAdagradWithDedicatedLRIteration) (46.475)
    ✓ Pass: caffe2/caffe2/python:optimizer_test - test_lr_injection (caffe2.caffe2.python.optimizer_test.TestAdagradWithDedicatedLRIteration) (46.475)
    ✓ Pass: caffe2/caffe2/python:optimizer_test - main (46.475)
Summary
  Pass: 5
  Skip: 1
    ↻ caffe2/caffe2/python:optimizer_test - testGPUDense (caffe2.caffe2.python.optimizer_test.TestAdagradWithDedicatedLRIteration)
  ListingSuccess: 1
```

Reviewed By: liangming168

Differential Revision: D38747417

Pull Request resolved: https://github.com/pytorch/pytorch/pull/85195
Approved by: https://github.com/liangming168, https://github.com/eellison
2022-09-27 00:56:57 +00:00
PyTorch MergeBot
0c7ca2d97b Revert "Add DLPack support for XPU backend by mapping to kDLOneAPI in DLPack (#82867)"
This reverts commit de0e03001d.

Reverted https://github.com/pytorch/pytorch/pull/82867 on behalf of https://github.com/kit1980 due to DLPack 0.7 is in conflict with the current usage of DLPack 0.6 internally
2022-08-07 20:38:29 +00:00
johnlu
de0e03001d Add DLPack support for XPU backend by mapping to kDLOneAPI in DLPack (#82867)
## Motivation
The DLPack device type kDLOneAPI stands for the Unified Shared Memory allocated on a oneAPI device. The corresponding Pytorch backend type is XPU.
Support to export/import the Pytorch XPU tensor as a DLPack tensor of kDLOneAPI device.

## Solution
1. Update the DLPack protocol to v0.7.
2. Add the XPU hooks to map the Aten device and DLPack device with the address value and device information.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82867
Approved by: https://github.com/kit1980
2022-08-05 06:41:42 +00:00
PyTorch MergeBot
0e16340f92 Revert "Add DLPack support for XPU backend by mapping to kDLOneAPI in DLPack. (#81021)"
This reverts commit 8be853025c.

Reverted https://github.com/pytorch/pytorch/pull/81021 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2022-08-05 01:51:39 +00:00