Commit Graph

51 Commits

Author SHA1 Message Date
d66c320b10 disable leaky_relu_ backward calculation with negative slope (#33639)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33639

Test Plan: Imported from OSS

Differential Revision: D20045735

Pulled By: glaringlee

fbshipit-source-id: b3becf30a8fe9ee178792bd88f6ee10102504ed5
2020-02-27 18:54:57 -08:00
cba8af9b24 [pytorch] Set alias analysis kind to FROM_SCHEMA for qadd, qmul, qclamp, qconcat (#33359)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33359

Updated alias analysis kind to FROM_SCHEMA so input tensors can be marked as nonmutable
when appropriate, allowing for constant folding of these tensors.

Needed to update the schemas of the _out variants with annotations to mark the output input
tensor as aliased and mutable.

Test Plan:
```
import torch

class M(torch.nn.Module):
    def __init__(self):
        super(M, self).__init__()

    def forward(self, x):
        w = torch.tensor([3], dtype=torch.float)
        w = torch.quantize_per_tensor(w, 1.0, 0, torch.qint8)
        y = torch.tensor([3], dtype=torch.float)
        y = torch.quantize_per_tensor(w, 1.0, 0, torch.qint8)
        return torch.ops.quantized.add_out(x, w, y)

m = torch.jit.script(M())
torch._C._jit_pass_constant_propagation(m.graph)
print(m.graph)
```
```
graph(%self : __torch__.___torch_mangle_9.M,
      %x.1 : Tensor):
  %11 : int = prim::Constant[value=12]() # <ipython-input-11-1dd94c30cb58>:9:49
  %9 : float = prim::Constant[value=1.]() # <ipython-input-11-1dd94c30cb58>:9:41
  %10 : int = prim::Constant[value=0]() # <ipython-input-11-1dd94c30cb58>:9:46
  %36 : QInt8(1) = prim::Constant[value={3}]()
  %y.2 : Tensor = aten::quantize_per_tensor(%36, %9, %10, %11) # <ipython-input-11-1dd94c30cb58>:11:12
  %24 : Tensor = quantized::add_out(%x.1, %36, %y.2) # <ipython-input-11-1dd94c30cb58>:12:15
  return (%24)
```
As expected, the aten::quantize_per_tensor() for w is now folded. The aten::quantize_per_tensor()
for y is not folded, since that tensor is aliased/modified.

Differential Revision: D19910667

fbshipit-source-id: 127071909573151dc664500d363399e3643441b7
2020-02-24 20:08:06 -08:00
6d448acb34 [PyTorch BC] Skip aten::random_ to fix BC CI (#33666)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33666

it's caused by a revert. So let's skip it.

Test Plan: ci

Reviewed By: hl475

Differential Revision: D20057382

fbshipit-source-id: d71af8efe68b31befcef5dddc372540e8a8ae2ac
2020-02-22 21:28:18 -08:00
90f4c5695e Revert "Revert D19975411: Remove special case codegen for tril_indices/triu_indices." (#33572)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33572

This reverts commit 687a7e4a2566861c53c8fb53a80b198465168b38.

Original PR #33305

Reland with BC tests whitelisted. See https://github.com/pytorch/pytorch/issues/33580 for reasoning why this change is not actually BC breaking.

Test Plan: Imported from OSS

Differential Revision: D20011011

Pulled By: ezyang

fbshipit-source-id: 116374efc93af12b8ad738a0989d6f0daa9569e2
2020-02-21 08:36:32 -08:00
5782758b54 Add instructions and operators for new bytecode format of PyText model (#33555)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33555

A quick fix for the PyText model (in internal production) on the new bytecode format.

Test Plan: Imported from OSS

Differential Revision: D20008266

Pulled By: iseeyuan

fbshipit-source-id: 1916bd0bf41093898713c567c7f6fa546b9ea440
2020-02-20 15:05:37 -08:00
c59e35b147 interpreter handling for varargs to remove need for looking at Node (#32791)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32791

When a registered operator has varags (ends with ... in its schema),
the interpreter now appends the number of arguments to the top of
the stack before invoking the operator. This allows the removal of more
uses of Node* in the interpreter.

This PR also then cleans up the constructors for Operator to make
it more likely someone chooses the correct one. After making these ops:

```
USES NODE: prim::TupleUnpack(...) -> (...)
USES NODE: prim::TupleSlice(...) -> (...)
USES NODE: prim::TupleConstruct(...) -> (...)
USES NODE: prim::ListUnpack(...) -> (...)
USES NODE: prim::ListConstruct(...) -> (...)
USES NODE: prim::DictConstruct(...) -> (...)
USES NODE: prim::Constant() -> (...)
USES NODE: prim::isinstance(...) -> (...)
USES NODE: prim::CreateObject(...) -> (...)
USES NODE: prim::fork(...) -> (...)
USES NODE: aten::warn(str message, *, int stacklevel=2) -> () # need stack level information, so ideally in interpreter so it can look at the stack
```

Into interpreter primitives, we can remove all but two constructors for operators:
one that is (schema_string, operation), and one that is (symbol, op_creator) for
the remaining weird primitives.

Test Plan: Imported from OSS

Differential Revision: D19673158

Pulled By: zdevito

fbshipit-source-id: 95442a001538a6f53c1db4a210f8557ef118de66
2020-02-18 15:04:48 -08:00
f6808df75f [BC] Temporarily fix the BC check (#33387)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33387

CI is broken. Skip two functions to fix the problem.

Test Plan: ci

Reviewed By: hl475

Differential Revision: D19926249

fbshipit-source-id: a46d1465c59de8616d2af5fb0b9cc18532359f88
2020-02-15 18:31:25 -08:00
93179b1c1c [jit] Initial use RRef in TorchScript (#33190)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33190

This enable the initial RRef type to be used inside TorchScript, user
could pass a python RRef into a torchscript function and call to_here
inside. Specifically, this PR:

- Add RRef schema type parsing
- Add python interop for RRef in Python and into JIT
- register to_here op in register_distributed_ops

More support for RRef in TorchScript will be added in future PRs

Test Plan: Imported from OSS

Differential Revision: D19871244

Pulled By: wanchaol

fbshipit-source-id: 7eca6c491a84666b261c70806254b705603bd663
2020-02-13 20:17:25 -08:00
03e9b9ce18 [PyTorch BC] Remove unnecessary items in whitelist (#33247)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33247

remove stale items.

Test Plan: ci

Reviewed By: hl475

Differential Revision: D19861294

fbshipit-source-id: 2b112e5908c19a1ff190e3850085038065d21c53
2020-02-12 21:34:18 -08:00
f045dab3dd Remove ImplicitTensorToNum (#32761)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32761

This replaces ImplicitTensorToNum with result-specific operators like
IntImplicit, FloatImplicit, or ScalarImplicit. Note that ScalarImplicit
was not correctly implemented before and this PR fixes the lapse.

This does not change on-disk serialization because these operators are not
serialized directly but written as eg. `annotated(int, foo)`.

Test Plan: Imported from OSS

Differential Revision: D19615385

Pulled By: zdevito

fbshipit-source-id: 48575f408e8219d2ec5b46936fc2aa691f283976
2020-02-12 14:49:07 -08:00
99349defc1 remove unnecessary Node* ops (#32760)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32760

Minor changes to the way ops are implemented to remove incidental use of Node*
in the operator implementation.

Current state for operators that previously took Node:

```
TBD:

USES NODE: prim::DifferentiableGraph(...) -> (...)
USES NODE: prim::profile(...) -> (...)
USES NODE: prim::FusionGroup(...) -> (...)
USES NODE: prim::PythonOp(...) -> (...)
USES NODE: prim::ImplicitTensorToNum(Tensor a) -> Scalar # next PR

Should be made interpreter primitives:

USES NODE: prim::TupleUnpack(...) -> (...)
USES NODE: prim::TupleSlice(...) -> (...)
USES NODE: prim::TupleConstruct(...) -> (...)
USES NODE: prim::ListUnpack(...) -> (...)
USES NODE: prim::ListConstruct(...) -> (...)
USES NODE: prim::DictConstruct(...) -> (...)
USES NODE: prim::Constant() -> (...)
USES NODE: prim::isinstance(...) -> (...)
USES NODE: prim::CreateObject(...) -> (...)
USES NODE: prim::fork(...) -> (...)
USES NODE: aten::warn(str message, *, int stacklevel=2) -> () # need stack level information, so ideally in interpreter so it can look at the stack

Should be made into vararg operators, i.e. the operators last argument should be an IValue
that contains the number of arguments.

USES NODE: prim::FusedConcat(...) -> (...)
USES NODE: prim::MMTreeReduce(...) -> (...)
USES NODE: prim::MMBatchSide(...) -> (...)
USES NODE: prim::ConstantChunk(...) -> (...)
USES NODE: prim::AutogradAnyNonZero(...) -> bool
USES NODE: prim::BroadcastSizes(...) -> (...)
USES NODE: prim::ChunkSizes(...) -> (...)
USES NODE: aten::format(str self, ...) -> str
USES NODE: prim::Print(...) -> (...)

fixed:

USES NODE: aten::extend(Tensor[](a!) self, Tensor [] other) -> ()
USES NODE: aten::copy(Tensor[](a) self) -> Tensor[]
USES NODE: aten::extend(int[](a!) self, int [] other) -> ()
USES NODE: aten::copy(int[](a) self) -> int[]
USES NODE: aten::extend(float[](a!) self, float [] other) -> ()
USES NODE: aten::copy(float[](a) self) -> float[]
USES NODE: aten::extend(bool[](a!) self, bool [] other) -> ()
USES NODE: aten::copy(bool[](a) self) -> bool[]
USES NODE: aten::extend(t[](a!) self, t [] other) -> ()
USES NODE: aten::copy(t[](a) self) -> t[]
USES NODE: aten::keys(Dict(str, t) self) -> str[](*)
USES NODE: aten::values(Dict(str, t) self) -> t[](*)
USES NODE: aten::dict((str, tVal)[] inputs) -> Dict(str, tVal)
USES NODE: aten::keys(Dict(int, t) self) -> int[](*)
USES NODE: aten::values(Dict(int, t) self) -> t[](*)
USES NODE: aten::dict((int, tVal)[] inputs) -> Dict(int, tVal)
USES NODE: aten::keys(Dict(float, t) self) -> float[](*)
USES NODE: aten::values(Dict(float, t) self) -> t[](*)
USES NODE: aten::dict((float, tVal)[] inputs) -> Dict(float, tVal)
USES NODE: aten::keys(Dict(Tensor, t) self) -> Tensor[](*)
USES NODE: aten::values(Dict(Tensor, t) self) -> t[](*)
USES NODE: aten::dict((Tensor, tVal)[] inputs) -> Dict(Tensor, tVal)
USES NODE: aten::test_vartype2(t a, t[] b) -> (t[])
USES NODE: aten::_ncf_unsqueeze(Tensor self, int ndim) -> Tensor
USES NODE: aten::_ncf_view(Tensor self, int[] input_shape, int normalized_ndim) -> Tensor
USES NODE: prim::is_none(int? a) -> bool
USES NODE: aten::__interpolate(Tensor input, int? size = None, float[]? scale_factor = None, str mode = 'nearest', bool? align_corners = None, bool? recompute_scale_factor = None) -> Tensor
USES NODE: aten::__interpolate(Tensor input, int[]? size = None, float[]? scale_factor = None, str mode = 'nearest', bool? align_corners = None, bool? recompute_scale_factor = None) -> Tensor
USES NODE: aten::__interpolate(Tensor input, int? size = None, float? scale_factor = None, str mode = 'nearest', bool? align_corners = None, bool? recompute_scale_factor = None) -> Tensor
USES NODE: aten::__interpolate(Tensor input, int[]? size = None, float? scale_factor = None, str mode = 'nearest', bool? align_corners = None, bool? recompute_scale_factor = None) -> Tensor
USES NODE: aten::sorted(t[](a) self) -> (t[])
USES NODE: aten::sort(t[](a!) self, bool reverse=False) -> ()
USES NODE: aten::test_vartype(t[] a, t b) -> (t)
USES NODE: prim::unchecked_unwrap_optional(t(a)? optional) -> t(a)
USES NODE: prim::unchecked_cast(...) -> (...)
USES NODE: aten::dict() -> Dict(str, Tensor)
USES NODE: prim::Load(...) -> (...)
USES NODE: prim::Store(...) -> (...)
USES NODE: prim::Drop(...) -> (...)
USES NODE: aten::tensor(t[] data, *, ScalarType? dtype=None, Device? device=None, bool requires_grad=False) -> Tensor
USES NODE: aten::as_tensor(t[] data, *, ScalarType? dtype=None, Device? device=None) -> Tensor
```

Test Plan: Imported from OSS

Differential Revision: D19615387

Pulled By: zdevito

fbshipit-source-id: 95298c3c4249b9f812c332d13f0fb79daeecb662
2020-02-12 14:49:02 -08:00
bcb7c22679 [PyTorch BC] Fix the ci (#32843)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32843

fix the ci by skipping aten::join

Test Plan: ci

Reviewed By: hl475

Differential Revision: D19650584

fbshipit-source-id: 4446eef568ded334217ff9205a795daffebe41a1
2020-01-30 16:05:03 -08:00
cc35c876cb Fix backcompat for linear_relu_dynamic_fp16 (#32803)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32803

Stack from [ghstack](https://github.com/ezyang/ghstack):
* **#32803 Fix backcompat for linear_relu_dynamic_fp16**

Test Plan: Imported from OSS

Reviewed By: jamesr66a

Differential Revision: D19642281

Pulled By: albanD

fbshipit-source-id: 3b6ae4dd81bf8a70dd81ccbb02fffd7653bbd08c
2020-01-30 08:08:29 -08:00
9e59244b53 fix view listing in autograd codegen (#32044)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32044

Fix the list of views in the codegen:
- Move `narrow` out of the autograd functions since it's now implemented with slice.
- Add `split_with_sizes` that was missing from the list
- Remove special formulas for both `split` and `split_with_sizes`. Both used not to be considered as views. When they are, all the rnn code breaks because it uses them in an invalid way. The generic formula will generate one `narrow` Node for each output. Which is always valid.

The diff for the generated code can be found [here](https://github.com/pytorch/pytorch/compare/16eff6e...albanD:06d6e85) (outdated for last commit)

Test Plan: Imported from OSS

Differential Revision: D19409648

Pulled By: albanD

fbshipit-source-id: 5ebc4c978af500403f7f008c0231b7db0cabab26
2020-01-24 14:31:21 -08:00
6745bfc31c Revert "Remove __torch__ from custom class qualname" (#32514)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32514

This reverts commit c7fdf5b251c6fecd5d78b4f33d30bd77ca3f841c.

Test Plan: Imported from OSS

Differential Revision: D19525532

Pulled By: jamesr66a

fbshipit-source-id: 126f4e87250a2ac739bd7aa161a0f7b39f143d38
2020-01-23 14:56:25 -08:00
ea7bebb7fe [PyTorch BC] Clean up the whitelist for PyTorch Op BC check (#32523)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32523

remove stale items

Test Plan: cont build

Reviewed By: hl475

Differential Revision: D19526918

fbshipit-source-id: ee7392ae84e5ddf88284020775119e59c9b6533e
2020-01-23 09:25:37 -08:00
9e853e7090 Revert "Temporary workaround for BC test due to schema parser changes" (#32441)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32441

This reverts commit ceffdbd2179e7dafdc6407909a00f4267db040de.

Test Plan: Imported from OSS

Reviewed By: houseroad

Differential Revision: D19500043

Pulled By: jamesr66a

fbshipit-source-id: 3bd22c55e4a81ff8b89d27f6e7438e3bdfc18606
2020-01-21 12:07:46 -08:00
839fe714de Fix BC test after TorchBind cahnges (#32429)
Summary:
It was broken by https://github.com/pytorch/pytorch/issues/32320. Let's be on the safe side and just whitelist all testing ops
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32429

Differential Revision: D19501016

Pulled By: dzhulgakov

fbshipit-source-id: 9cc1d363edb4579905bee1976a2b57255ce41738
2020-01-21 11:30:44 -08:00
ceffdbd217 Temporary workaround for BC test due to schema parser changes
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/32324

Test Plan: Imported from OSS

Differential Revision: D19438085

Pulled By: jamesr66a

fbshipit-source-id: 3dd2586e73c890a7bdadd6cbb3df2c186f93199d
2020-01-17 23:08:20 -08:00
67ff051ddd Remove temporary fix for torchbind in BC check (#31982)
Summary:
Remove the patch
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31982

Reviewed By: hl475

Differential Revision: D19333205

Pulled By: houseroad

fbshipit-source-id: 1d16fd31ede7266789141238520d47b762a7a340
2020-01-09 13:58:16 -08:00
c299cb05ef temporary fix for jit test backward compatibility issues
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/31949

Test Plan: Imported from OSS

Differential Revision: D19314763

Pulled By: albanD

fbshipit-source-id: b5eff0ed53a371d260596ca85d914c8bddb0a8aa
2020-01-08 13:32:08 -08:00
34561dadcd Don't handle bias inside cudnn_convolution* (#31524)
Summary:
Compared to cuDNN bias, PyTorch add has the following advantage:
- faster, especially for backward (see: https://github.com/zasdfgbnm/things/blob/master/2019/conv-backward-profile.md)
- handles 64bit indexing automatically
- has less code, less maintenance effort

ngimel I submit this PR early so the CI could start building it. But I have not tested it locally yet (still waiting for compiling).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31524

Differential Revision: D19264244

Pulled By: ngimel

fbshipit-source-id: cb483d378a6d8bce0a05c3643a796e544bd8e8f0
2020-01-06 16:47:54 -08:00
f362cd510d Move prim ops from JIT registration to C10 (#30612)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30612

The first version to move prim ops to c10 registration. After the reviewers are fine with the initial changes, more operators will be moved in the same style.

Test Plan: Imported from OSS

Differential Revision: D19237648

Pulled By: iseeyuan

fbshipit-source-id: c5a519604efffb80564a556536f17d829f71d9f9
2020-01-04 13:47:44 -08:00
7078f4b27d skip _test_optional_float in BC check (#31786)
Summary:
Skip _test_optional_float
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31786

Reviewed By: hl475

Differential Revision: D19265059

Pulled By: houseroad

fbshipit-source-id: 6b95bd3b8cad83a4c459c0603befaaeeade6cdff
2020-01-02 11:12:38 -08:00
c4f10e0fe7 Renaming scales parameter for interpolate (#31526)
Summary:
PR separated from https://github.com/pytorch/pytorch/pull/31274.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31526

Reviewed By: zou3519

Differential Revision: D19221931

Pulled By: gchanan

fbshipit-source-id: 81958a9910867ac9d62f2b47abc49384526c4e51
2020-01-02 08:19:30 -08:00
ffcac9ad37 Clean White List for BC Checks (#31629)
Summary:
Delete obsolete items
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31629

Reviewed By: hl475

Differential Revision: D19231522

Pulled By: houseroad

fbshipit-source-id: 393ed630f7854b643c8fa8c5f3f576718934de96
2019-12-26 21:21:39 -08:00
5d95a9ca79 Print all broken ops instead of the first one (#31628)
Summary:
Originally, we only print one broken schema. With this changeset, all the broken schemas are printed out.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31628

Reviewed By: hl475

Differential Revision: D19231444

Pulled By: houseroad

fbshipit-source-id: 3dd5b4609a6a9a9046e95f2f30deb9beeb5dcd56
2019-12-26 12:51:43 -08:00
363d8be787 Bypass _TorchScriptTesting_StackString::pop in BC check now (#31586)
Summary:
Failed result: https://circleci.com/gh/pytorch/pytorch/4054919?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link/console

Original PR: https://github.com/pytorch/pytorch/pull/30242
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31586

Reviewed By: hl475

Differential Revision: D19222086

Pulled By: houseroad

fbshipit-source-id: 96db2bf18fa06eaebdd558e86615e26b95f34516
2019-12-23 22:00:20 -08:00
87f29557bd Ignore logical_and and logical_or in op BC check for now (#30537)
Summary:
Get the CI happy.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30537

Reviewed By: hl475

Differential Revision: D18738567

Pulled By: houseroad

fbshipit-source-id: f30a87e22653b83ebdb1b54851460ec245866ecf
2019-11-27 16:59:37 -08:00
559b3b5a7a Use unboxed registration for most of operators used in lite interpreter. (#30239)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30239

Use unboxed registration per smessmer 's request. For some ops with optional arg or tensor list that unboxed registration are not supported, we still use boxed.

Test Plan: Imported from OSS

Differential Revision: D18653846

Pulled By: iseeyuan

fbshipit-source-id: c22ce8111dfff0ba63316a9bcfe2b712b2d31fc1
2019-11-22 10:00:30 -08:00
f7b12a9858 fix aten::grad to return optional list (#29577)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29577

`torch.autograd.grad` can return none is one of the input is not in the
autograd graph or not requires_grad, this fix it so that it return a
list of optional tensor instead of list of tensor.

This might have BC issue unfortunately, but I think it's rare both
internal and external (only training use it, and most of the training
use backward, instead of autograd.grad), so whitelist it.

Test Plan: Imported from OSS

Differential Revision: D18491642

fbshipit-source-id: d32b2b3446cf9e8b9a98f6d203a21a75643d8991
2019-11-20 22:19:10 -08:00
b011461c9f Add missing operators for pytext, v2 (#29970)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29970

Add operators and JMP instruction used in PyText model in lite interpreter.

Test Plan: Imported from OSS

Differential Revision: D18555483

fbshipit-source-id: e5124d908762f78fb548505aecf33be8c8503275
2019-11-16 23:59:12 -08:00
6980cb2519 Add overload name to JIT prim operators, version 2 (#29960)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29960

Overload name is required in mobile operators with the same name but different schema. Since it's not used in JIT, it's safe to add overload names for JIT operators.

Test Plan: Imported from OSS

Differential Revision: D18555484

fbshipit-source-id: b451379af24e255d8b0c61b964ae32fd1a64ed34
2019-11-16 23:59:07 -08:00
1bb5209f7e Back out "Revert D18299298: [pytorch][PR] Migrate conv3d from TH to ATen (CPU)" (#29286)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29286

Original commit changeset: 33057d5a91d1
ghstack-source-id: 93638554

Test Plan: sandcastle and ossci

Differential Revision: D18349945

fbshipit-source-id: 9d9ddb0c185248a2073ade1063bb69ffbfa48b46
2019-11-11 17:33:14 -08:00
46c4ae5719 Fix BC CI (#29533)
Summary:
skip _nnpack_spatial_convolution for now.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29533

Reviewed By: hl475

Differential Revision: D18421636

Pulled By: houseroad

fbshipit-source-id: 74ceaa753cf2faa16db89ea028fe275497b673c1
2019-11-10 16:04:01 -08:00
b7fc26a9ef Clean up the stale item in bc white list (#29439)
Summary:
keep the list clean
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29439

Reviewed By: hl475

Differential Revision: D18392445

Pulled By: houseroad

fbshipit-source-id: 2cfe66620e0e9275a0f9590e453c9be10c82124a
2019-11-08 07:06:48 -08:00
Jie
fdab1cf0d4 NHWC support in cuDNN BatchNorm & Conv2d (#29361)
Summary:
This reverts the 9a9bb448ee49a1493f22bbbeed4af92b1364fce9

Fixing the broken case which reverts the previous commit.
details about fix:
	modified:   aten/src/ATen/native/Convolution.cpp

called contiguous on 3D input tensor. This avoids the code path to accidentally
recognize the input as channel_last stride, due to unsqueezing of permuted 3d
tensor.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29361

Differential Revision: D18371964

Pulled By: VitalyFedyunin

fbshipit-source-id: a5985f4687b37e183649fa35b8ccdb50368ebfdf
2019-11-07 10:39:58 -08:00
9a9bb448ee Revert cudnn changes #23861 (#29329)
Summary:
Broken case:

```python
x = torch.randn(192,16,50).cuda()
x = x.permute(0,2,1).contiguous().permute(0,2,1)
m = torch.nn.Conv1d(
       in_channels=16,
       out_channels=32,
       kernel_size=2,
       bias=True,
  ).cuda()

m(x)
```

This reverts commit 8160f390cf678b3b98e0c1f73bd289ee3c96afcb.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29329

Differential Revision: D18357674

Pulled By: VitalyFedyunin

fbshipit-source-id: cdd7e77e8dcbfc5f2ab3df54eb53ccfbf703b245
2019-11-06 17:38:46 -08:00
f1c78492f8 Revert D18299298: Migrate conv3d from TH to ATen (CPU)
Test Plan: revert-hammer

Differential Revision:
D18299298

Original commit changeset: 97d53e8c976a

fbshipit-source-id: 33057d5a91d11bca136f69bc2d6ff0699d31492a
2019-11-05 11:26:48 -08:00
546ae3002d Migrate conv3d from TH to ATen (CPU) (#29007)
Summary:
This is a port of the VolumetricConvolutionMM TH (CPU) implementation to ATen as `slow_conv3d`.

- [x] unfolded3d_copy & unfolded3d_acc
- [x] forward
- [x] backward
- [x] basic sanity cross check with 1.3 impl
- [ ] systematic testing
- [ ] performance comparison & optimization

Script used for performance testing: [benchmark_conv3d.py](https://gist.github.com/andreaskoepf/8865eea4bb05220f78fc6d9d408c49fc)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29007

Differential Revision: D18299298

Pulled By: ezyang

fbshipit-source-id: 97d53e8c976a09aecbc6f05dd8e982cc58cdf6d8
2019-11-05 08:09:20 -08:00
Jie
8160f390cf (#23861)
Summary:
Added nhwc support for:
1. cudnn_batch_norm & cudnn_batch_norm_backward
2. cudnn_convolution_forward & cudnn_convolution_backward
3. cudnn_convolution_transpose & cudnn_convolution_transpose_backward

patching suggest_memory_format for convolution

suggest_memory_format has ambiguous meaning for two cases:
1. tensor with NCHW where C = 1.
   we could use stride of C as a hint to tell the intended memory format.
2. tensor with NCHW where H == W == 1.
   there's no way to identify the intended memory format from strides.

Currently we fallback to NCHW whenever we see contiguous tensor. Hence avoiding
ambiguity for some of the special cases.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23861

Differential Revision: D18263434

Pulled By: VitalyFedyunin

fbshipit-source-id: dd9f69576ec12fec879cd87a3d446931371360d9
2019-11-04 09:11:50 -08:00
4e56455b09 whitelist autogradanynonzero (#28852)
Summary:
prim::AutogradAnyNonZero is optimized away under normal circumstances (a graph executor specializes tensor arguments and runs `specializeAutogradZero`), so the change should be backward compatible for as long as we are running the original executor.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28852

Differential Revision: D18213118

Pulled By: Krovatkin

fbshipit-source-id: 223f172c59e5f2b05460db7de98edbadc45dd73d
2019-10-29 17:00:27 -07:00
097da55249 Fix BC check CI (#28816)
Summary:
Skip the functions which were reverted.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28816

Reviewed By: hl475

Differential Revision: D18196628

Pulled By: houseroad

fbshipit-source-id: 30d43fcd57efb21b870c6a630b7ee305604dc603
2019-10-28 21:47:18 -07:00
baf8488dbd Add memory format support to empty_like operator (#27244)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27244

Adds memory_format keyword argument (positional for cpp).

'Preserve' behavior now follows next rules:
1) If tensor is non-overlapping and dense - output tensor will have the same strides as input tensor.
2) If not (1) and tensor is stored in the channels last format, output tensor going to have channels last format.
3) Output tensor is going to be contiguous in all other cases.

 ---
Dense tensor is the tensor that store values in a contiguous block of memory.
Non-overlapping tensor is the tensor in which elements occupy individual non-repetitive memory.

Test Plan: Imported from OSS

Reviewed By: ezyang

Differential Revision: D17980310

Pulled By: VitalyFedyunin

fbshipit-source-id: 00a39b40daa4b8ee63c32e60d920222f8be2d6a1
2019-10-25 07:29:00 -07:00
005d6ea495 Fix overload names (#28182)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28182

They haven't been unique. Fixing it...
ghstack-source-id: 92436985

Test Plan: waitforsandcastle

Differential Revision: D17969010

fbshipit-source-id: 1aacbfb3c18a75ca6743b03cc2eea5fc4d3685c9
2019-10-23 01:33:35 -07:00
53d9456adf Clean up the stale item in bc white list (#28269)
Summary:
Remove one stale item
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28269

Reviewed By: hl475, BIT-silence

Differential Revision: D18000957

Pulled By: houseroad

fbshipit-source-id: bc50f80453ce9c675928e6db784d5ebe05861f2a
2019-10-17 21:35:30 -07:00
8b87f9a510 Add fused layer norm impl on CUDA in PyTorch (#27634)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27634

Add fused layer norm impl on CUDA in PyTorch

Performance benchmark compare to apex.FusedLayerNorm on a V100 machine.

**************************************
Shape = (128, 2097152)
  curr LayerNorm forward: 7.252584544941783ms
  apex LayerNorm forward: 10.366813436849043ms
  curr LayerNorm backward: 15.568048988003284ms
  apex LayerNorm backward: 20.869979876093566ms
**************************************
Shape = (256, 1048576)
  curr LayerNorm forward: 5.185673736967146ms
  apex LayerNorm forward: 6.3868385690730065ms
  curr LayerNorm backward: 13.942008479032665ms
  apex LayerNorm backward: 15.469660016940907ms
**************************************
Shape = (512, 524288)
  curr LayerNorm forward: 4.672068868065253ms
  apex LayerNorm forward: 4.717993081081659ms
  curr LayerNorm backward: 13.46354596503079ms
  apex LayerNorm backward: 14.04774487693794ms
**************************************
Shape = (1024, 262144)
  curr LayerNorm forward: 4.547273400006816ms
  apex LayerNorm forward: 5.378365494078025ms
  curr LayerNorm backward: 13.425063178874552ms
  apex LayerNorm backward: 14.235145597020164ms
**************************************
Shape = (2048, 131072)
  curr LayerNorm forward: 4.526399010093883ms
  apex LayerNorm forward: 4.775081946980208ms
  curr LayerNorm backward: 13.222738380078226ms
  apex LayerNorm backward: 13.59594238596037ms
**************************************
Shape = (4096, 65536)
  curr LayerNorm forward: 4.28789056581445ms
  apex LayerNorm forward: 4.48913648002781ms
  curr LayerNorm backward: 13.026655421825126ms
  apex LayerNorm backward: 13.57052089786157ms
**************************************
Shape = (8192, 32768)
  curr LayerNorm forward: 4.243518367875367ms
  apex LayerNorm forward: 4.34588153520599ms
  curr LayerNorm backward: 13.140627697808668ms
  apex LayerNorm backward: 13.49891544203274ms
**************************************
Shape = (16384, 16384)
  curr LayerNorm forward: 4.181216162163764ms
  apex LayerNorm forward: 4.268723972840235ms
  curr LayerNorm backward: 13.035593512002379ms
  apex LayerNorm backward: 13.463351831072941ms
**************************************
Shape = (32768, 8192)
  curr LayerNorm forward: 4.097899778978899ms
  apex LayerNorm forward: 4.109480210812762ms
  curr LayerNorm backward: 13.041268918896094ms
  apex LayerNorm backward: 13.586135944118723ms

Test Plan: buck test mode/dev-nosan caffe2/test:nn -- "LayerNorm"

Reviewed By: houseroad

Differential Revision: D17462420

fbshipit-source-id: d4a67d160bb4eff73ffac64af46c56c3845cf211
2019-10-14 21:26:33 -07:00
4fb442985a Add c10_experimental ops to BC check white list (#27235)
Summary:
experimental ops doesn't provide bc guarantee.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27235

Reviewed By: hl475

Differential Revision: D17723292

Pulled By: houseroad

fbshipit-source-id: 644ae34d130418a810e0f9d802fa25f6e34c5ccf
2019-10-02 18:05:08 -07:00
764bf826e3 Remove fbgemm_is_cpu_supported in favor of torch.backends.quantized.supported_qengines (#26840)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26840

Cleaning up top-level namespace. Also cosmetic changes to torch.backends.quantized

Test Plan: Imported from OSS

Differential Revision: D17604403

Pulled By: dzhulgakov

fbshipit-source-id: c55af277ea7319d962a82a6120f65ccd47a60abc
2019-09-27 13:45:15 -07:00
89c5dc57d9 Add whitelist for backward compatible checks for function schemas (#26740)
Summary:
Now, we skip all function schema contains quantize key word
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26740

Reviewed By: hl475

Differential Revision: D17561753

Pulled By: houseroad

fbshipit-source-id: c5e47ada072e71bfa2341a0af8f1743e86ef733c
2019-09-24 17:31:04 -07:00