Commit Graph

2494 Commits

Author SHA1 Message Date
Bram Wasti
3df7b321cc Expose BoxWithNMSLimit (#16529)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16529

..

Reviewed By: smessmer

Differential Revision: D13865221

fbshipit-source-id: 8a3f1d420183ed5ae51b3c9e4eb6e033078c7ae4
2019-02-05 12:56:56 -08:00
Bram Wasti
add39b85cc Expose BBoxTransform to pytorch (#16530)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16530

..

Reviewed By: smessmer

Differential Revision: D13864292

fbshipit-source-id: 1f57664e78347e72c0087aa3d825a6a9517c1945
2019-02-05 12:56:54 -08:00
Bram Wasti
f33a2b960e Expose GenerateProposals to torch (#16477)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16477

expose generateproposals to torch

Reviewed By: smessmer

Differential Revision: D13856086

fbshipit-source-id: a4873646a71a6b6c01740d21729e827f4b36588f
2019-02-05 12:56:52 -08:00
Bram Wasti
f5d4636021 Expose RoIAlign to torch (#16476)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16476

enable calling roialign (caffe2) from torch frontend

Reviewed By: smessmer

Differential Revision: D13855525

fbshipit-source-id: cfee7bb1544dc58df4231604ba01d61ca905ae3f
2019-02-05 12:56:50 -08:00
Bram Wasti
240240bb10 LayerNorm Registration Example (#16478)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16478

This diff includes an example registration of a caffe2 op in torch.  A previous attempt ran into a static initialization order bug.

Reviewed By: smessmer

Differential Revision: D13854304

fbshipit-source-id: ec463ce2272126d08a5163d1599361ee5b718bbc
2019-02-05 12:56:48 -08:00
Dmytro Dzhulgakov
dc528fd734 Fix build with cuda but no cudnn in caffe2 (#16701)
Summary:
Just noticed while building on a machine without cudnn present - it was building but the runtime failed since some methods weren't bound
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16701

Differential Revision: D13937247

Pulled By: dzhulgakov

fbshipit-source-id: c81f05be7a9e64a1a8591036dcf8692c0ed4064e
2019-02-03 22:14:51 -08:00
Sebastian Messmer
f36f3cce9a Simplify layer_norm_op_test
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16570

Reviewed By: ezyang

Differential Revision: D13883913

fbshipit-source-id: 7437d3cbc00c0de92bb01562c620cb658aa9f0d3
2019-02-01 21:34:18 -08:00
Hui Wu
31ab03e34f Add Winograd Conv method for CPU (#15196)
Summary:
Add winograd conv method. Users can select the direct conv or winograd conv in the model file.
We close the origin pr https://github.com/pytorch/pytorch/pull/12154 and create this new one for better rebasing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15196

Differential Revision: D13463721

Pulled By: yinghai

fbshipit-source-id: c5cd5c8aa7622ae7e52aeabd3dbb8ffb99b9b4ee
2019-02-01 16:41:30 -08:00
peter.yeh@amd.com
10cd9d5a03 Skip dag_net_forking test on Rocm (#16639)
Summary:
-Skip the test due to flaky behavior on AMD/Rocm
-The fix is expected in Rocm 2.2 ( HSA runtime)
bddppq
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16639

Differential Revision: D13915231

Pulled By: bddppq

fbshipit-source-id: 66e1d275836337170b15ceb9d60cfdd3242d4df8
2019-02-01 00:53:54 -08:00
Xiaomeng Yang
4ae9ab24b6 Update conv_base to support empty batch (#16603)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16603

Update conv_base to support empty batch

Reviewed By: houseroad

Differential Revision: D13894111

fbshipit-source-id: fc4370ff16ba6046f374e77bd845d28e6af05ea3
2019-01-31 23:46:18 -08:00
Jerry Zhang
d5d7718770 fix scope related naming issue in build_quant_conv_bn_relu, and also format function signature
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14885

Reviewed By: harouwu

Differential Revision: D13374077

fbshipit-source-id: 5082c4ea0d2fdc197243b022b9b489f38b04c8e9
2019-01-31 15:53:27 -08:00
Dmytro Dzhulgakov
51752e09c6 Disable layernorm_c10 test for now (#16630)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16630

two PRs landed concurrently - enforcing tensor constraints and refactoring c10. Since it's not a prod code - disable test and I'll let Sebastian to fix it properly.

Reviewed By: ezyang

Differential Revision: D13908117

fbshipit-source-id: 381c5626078b794afa1fc7a95cb1ea529650424c
2019-01-31 15:47:13 -08:00
Jongsoo Park
db121375e7 more careful use of inline/template function in perfkernels (#15388)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15388

This is another pass to make perfkernels code safer from illegal instruction error.
Removed dependency to c10/util/Logging.h
We're err on the safer side at the expense of some verbosity.

Reviewed By: dskhudia

Differential Revision: D13502902

fbshipit-source-id: 4f833115df885c5b4f8c1ca83b9badea1553f944
2019-01-30 22:49:37 -08:00
Jerry Zhang
d3742603cb DeviceScope support for CUDA and testing (#15357)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15357

Supporting device option in FQ bn folding for ITER related ops

Reviewed By: wat3rBro

Differential Revision: D13370259

fbshipit-source-id: 4324c2716dfa69ddedc661ae2b1ad34c2f6fc4b6
2019-01-30 18:42:12 -08:00
Sebastian Messmer
c43917b0a3 Add a test case calling caffe2 layer_norm from caffe2 executor but through the c10 dispatcher
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16283

Reviewed By: ezyang

Differential Revision: D13792591

fbshipit-source-id: 9c190649e38e8706549102b2e136ceaf508eb37f
2019-01-30 13:16:47 -08:00
Yinghai Lu
fa717cba63 Support int64_t shape data for ideep reshape op
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16533

Reviewed By: jerryzh168

Differential Revision: D13867402

fbshipit-source-id: ff53a851f142ef915ad69da3868bb3aab4d48987
2019-01-30 09:00:09 -08:00
Lu Fang
719134f3c3 Automatic update of fbcode/onnx to 15c33c945851907411619f599900c3852108e7e3 (#16493)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16493

Previous import was dc75285d4a1cff9618400164dfdb26c5a1bab70a

Included changes:
- **[15c33c9](https://github.com/onnx/onnx/commit/15c33c9)**: Add ppc64le build (#1768) <Chin Huang>
- **[198f840](https://github.com/onnx/onnx/commit/198f840)**: Update Broadcasting.md (#1769) <Verma-Rajat>
- **[60ac95f](https://github.com/onnx/onnx/commit/60ac95f)**: Merge back from release 1.4.1 (#1767) <Raymond Yang>
- **[a683372](https://github.com/onnx/onnx/commit/a683372)**: Bump up version number for v1.4.0 (#1761) (#1763) <Raymond Yang>
- **[dbf3581](https://github.com/onnx/onnx/commit/dbf3581)**: Add TfIdfVectorizer operator to ONNX (#1721) <Dmitri Smirnov>

Reviewed By: zrphercule

Differential Revision: D13858840

fbshipit-source-id: 1d00f63f265cc6deed965b92ed00c44f547ff03e
2019-01-29 13:48:49 -08:00
Your Name
e3c0926c44 Remove usage of deprecated "min_satisfying_examples" hypothesis setting (#16401)
Summary:
This setting has been deprecated in [hypythesis 3.56.0](d1b0df5b91/hypothesis-python/docs/changes.rst (3560---2018-04-17)) and recently has been removed in [hypothesis 4.x](d1b0df5b91/hypothesis-python/docs/changes.rst (400---2019-01-14)).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16401

Reviewed By: ezyang

Differential Revision: D13832528

Pulled By: bddppq

fbshipit-source-id: 04b9f1dfdf2dcfe0ef121dd02f7fbfdf6bf4aead
2019-01-28 14:17:10 -08:00
Sebastian Messmer
80f4374dde Handle stack correctly (#16246)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16246

The op schema says it returns multiple values, so let's actually return multiple values instead of one tuple.
For some reason, this did work when called from python (probably some auto-unpacking),
but once called from JIT, it segfaulted. This diff fixes that.

Reviewed By: dzhulgakov

Differential Revision: D13780147

fbshipit-source-id: fe94f82f4c53b7454f77c4484fca4ac9dc444475
2019-01-28 11:46:03 -08:00
Juan Miguel Pino
41e9b092a9 Revert D13821061: [redo][c10] layernorm example
Differential Revision:
D13821061

Original commit changeset: 82f0dade0145

fbshipit-source-id: e5b0b1bab0c9e731ae04add35e9a6c91656dd178
2019-01-25 22:52:04 -08:00
Bram Wasti
27a1ba3ef2 layernorm example (#16374)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16374

this fixes the original attempt in OSS (adds to CMake and python build files)

Reviewed By: smessmer

Differential Revision: D13821061

fbshipit-source-id: 82f0dade0145fd04bdf8e3cb3954b5790e918162
2019-01-25 16:52:33 -08:00
Gu, Jinghui
0e6791b275 Impl Shape op for mkldnn (#15266)
Summary:
Impl Shape op for mkldnn
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15266

Differential Revision: D13804558

Pulled By: yinghai

fbshipit-source-id: 8a35f608c23973d7a15c3d645aee4059eb55f245
2019-01-25 11:04:57 -08:00
Bram Wasti
958f846fb3 Back out "[c10] layernorm example"
Summary: Original commit changeset: 87240ca7f48d

Reviewed By: bddppq

Differential Revision: D13816657

fbshipit-source-id: bafcf0779d811c7e4a134cfb323a89352fa8c180
2019-01-25 10:22:30 -08:00
Junjie Bai
52135e9b12 Revert D13551909: [fbcode] logdevice for generic feature type
Differential Revision:
D13551909

Original commit changeset: 807830c50bee

fbshipit-source-id: 48cacf4ec1765253a9be9d78f4b28cc48330be59
2019-01-25 00:33:06 -08:00
Qin Huang
11a2b3799b logdevice for generic feature type (#16191)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16191

logdevice related modifications for generic feature type

we directly convert the generic feature structures to json strings, which corresponds to the column input in offline and dper

Reviewed By: itomatik

Differential Revision: D13551909

fbshipit-source-id: 807830c50bee569de202530bc3700374757793a2
2019-01-24 23:33:19 -08:00
Bram Wasti
265ed8ff45 layernorm example (#16350)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16350

Example usage of the new caffe2 integration

Reviewed By: smessmer

Differential Revision: D13408546

fbshipit-source-id: 87240ca7f48d653a70241d243aa0eb25efa67611
2019-01-24 22:28:22 -08:00
Jongsoo Park
6700eff03e disable testing group conv with EIGEN engine (#16335)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16335

group conv is not implemented with EIGEN engine so this diff disables related tests

Reviewed By: jamesr66a

Differential Revision: D13807204

fbshipit-source-id: 41f6de43da40882f57e64474520e185733caefb7
2019-01-24 16:39:20 -08:00
Jongsoo Park
f0dd85d141 reduce parameter space of test_1x1_conv to avoid timeout (#16223)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16223

As title says

Reviewed By: jamesr66a

Differential Revision: D13758202

fbshipit-source-id: 3cdffb80a5dad53b29e65e8eb0ae128edba70dbb
2019-01-24 14:17:11 -08:00
rohithkrn
ddeaa541aa fix typo in resnet50_trainer.py
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16219

Differential Revision: D13776742

Pulled By: bddppq

fbshipit-source-id: 10a6ab4c58159b3f619b739074f773662722c1d9
2019-01-22 17:28:04 -08:00
Lu Fang
c33512bdfc Automatic update of fbcode/onnx to c553fb32a0902ce5dd42e1b40123e9e9b38bdbe7 (#16190)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16190

Previous import was fd60104394fa353e1762f44ecad1b2166e33deef

Included changes:
- **[c553fb3](https://github.com/onnx/onnx/commit/c553fb3)**: Handle negative axis in scan shape inference (#1748) <G. Ramalingam>
- **[51b6ecc](https://github.com/onnx/onnx/commit/51b6ecc)**: external_data: Store large tensor values in separate files (#678) <Michał Karzyński>
- **[ba05f26](https://github.com/onnx/onnx/commit/ba05f26)**: Scan output axes (#1737) <G. Ramalingam>
- **[90920c0](https://github.com/onnx/onnx/commit/90920c0)**: Add NonZero op. (#1714) <Sergii Dymchenko>
- **[c4cf112](https://github.com/onnx/onnx/commit/c4cf112)**: fix the test cases for constantofshape (#1746) <Lu Fang>
- **[d902349](https://github.com/onnx/onnx/commit/d902349)**: Add sample implementation support (#1712) <Lu Fang>

Differential Revision: D13745693

fbshipit-source-id: 05e2cce9ae1dfa2865db83840df64673d55cea57
2019-01-21 09:46:29 -08:00
Lu Fang
daedec2350 Support ConstantOfShape in Caffe2 ONNX Backend (#16108)
Summary:
This PR is the prerequisite to land https://github.com/pytorch/pytorch/pull/16095
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16108

Reviewed By: BIT-silence

Differential Revision: D13725722

Pulled By: houseroad

fbshipit-source-id: 28c0fb72f075cd04f9db44dfab0163844c20c620
2019-01-18 22:58:23 -08:00
Dmytro Dzhulgakov
aaff2fecda Remove caffe2::Tensor copy constructor (#15416)
Summary:
Based on offline discussion it should be less surprising to the users of existing code. Thus caffe2::Tensor is now a move-only class (as it used to be), explicit calls to UnsafeSharedInstance() are necessary to get shared_ptr behavior.

This change also identified a few places that misused the copy constructor - those are fixed

Pull Request resolved: https://github.com/pytorch/pytorch/pull/15416

Reviewed By: Yangqing

Differential Revision: D13524598

fbshipit-source-id: aea12d6dff77342606fa88ce4ddddbff266245a7
2019-01-18 00:31:56 -08:00
bddppq
1a09a2a27f Export PyTorch erf to ONNX Erf and add Caffe2 Erf operator
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16106

Differential Revision: D13709490

Pulled By: bddppq

fbshipit-source-id: 1b5b32261f06543371f7bd7ac9b11957a5eb4ad0
2019-01-17 09:18:08 -08:00
Derek Kim
1e425d1a47 A trivial typo fix in caffe2.python (#15907)
Summary:
blobl -> globl
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15907

Differential Revision: D13709586

Pulled By: ezyang

fbshipit-source-id: 9d3ad76b7fea76c7934407d3c164417b4157e234
2019-01-17 04:57:34 -08:00
Xiaomeng Yang
7536887cb7 Add count_include_pad for avg_pool on CuDNN (#16100)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16100

Add count_include_pad for avg_pool on CuDNN

Reviewed By: houseroad

Differential Revision: D13707959

fbshipit-source-id: 261f5d116066fef75cf9a5787dfbc5d12b5b9f9b
2019-01-17 02:10:12 -08:00
Xiaomeng Yang
7a5f782c2e Fix max_pool_grad test (#16088)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16088

Fix max_pool_grad test

Reviewed By: houseroad

Differential Revision: D13700917

fbshipit-source-id: f4f942ee920bcd943c38a8f8a6aafd1d13c4515f
2019-01-16 15:32:27 -08:00
Jerry Zhang
5e72e99c86 Remaining Tensor API fixes - dims() -> sizes() (#15743)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15743

Remaining fixes so that D12812029 will compile

Reviewed By: dzhulgakov

Differential Revision: D13535559

fbshipit-source-id: 2c8b3403570c8c35ac8efe2d827233abc0e6e0d1
2019-01-15 18:42:02 -08:00
Lu Fang
8f11df3cb7 Automatic update of fbcode/onnx to 84a0441ae28795a928005863dc142bee81827566 (#16046)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16046

Previous import was 7abd834091f1024c11749dcfd25126802db9fdd5

Included changes:
- **[84a0441](https://github.com/onnx/onnx/commit/84a0441)**: Clarify namescopes in the presence of nested subgraphs (#1665) <G. Ramalingam>
- **[118fec5](https://github.com/onnx/onnx/commit/118fec5)**: Add Where op. (#1569) <Sergii Dymchenko>
- **[beefa15](https://github.com/onnx/onnx/commit/beefa15)**: Use strings directly for casing as np.object w/o redundant StringHolder. (#1736) <Dmitri Smirnov>
- **[4023bae](https://github.com/onnx/onnx/commit/4023bae)**: Add a capability to input/output unicode strings (#1734) <Dmitri Smirnov>
- **[1a8a7fc](https://github.com/onnx/onnx/commit/1a8a7fc)**: typos fixed: iutput -> input (#1726) <Beomsoo Kim>
- **[0128478](https://github.com/onnx/onnx/commit/0128478)**: Scan test update (#1732) <G. Ramalingam>
- **[c6a24fd](https://github.com/onnx/onnx/commit/c6a24fd)**: turn rtol to 0.002 on densenet121, since AMD and Nvidia GPU's precion difference (#1733) <Lu Fang>
- **[5b7ac72](https://github.com/onnx/onnx/commit/5b7ac72)**: Add Shrink operator (#1622) <Rui Zhu>

Reviewed By: yinghai

Differential Revision: D13676711

fbshipit-source-id: 513cc137223469b47af48919432aaecf58006012
2019-01-15 17:17:31 -08:00
Xiaomeng Yang
13f38ab79d Add count_include_pad to average_pool_gradient_op (#15997)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15997

Add count_include_pad to average_pool_gradient_op

Reviewed By: houseroad

Differential Revision: D13648339

fbshipit-source-id: 205cb2acb32dc24a85256b628298b1a11f0ffa2c
2019-01-15 16:56:40 -08:00
Sebastian Messmer
57b5e7572b Test cases for calling caffe2 LayerNorm from PyTorch and JIT
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15895

Reviewed By: dzhulgakov

Differential Revision: D13615336

fbshipit-source-id: de28fef8ce025d6d37a4c80c029ec97b7195cfd9
2019-01-15 12:03:57 -08:00
Shane Li
620ff25bdb Enhance cpu support on gloo based multi-nodes mode. (#11330)
Summary:
1. Add some gloo communication operators into related fallback list;
2. Work around to avoid compiling errors while using fallback operator whose CPU operator inherits from 'OperatorBase' directly like PrefetchOperator;
3. Add new cpu context support for some python module files and resnet50 training example file.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11330

Reviewed By: yinghai

Differential Revision: D13624519

Pulled By: wesolwsk

fbshipit-source-id: ce39d57ddb8cd7786db2e873bfe954069d972f4f
2019-01-15 11:47:10 -08:00
Sebastian Messmer
4ed9de8680 Remove code duplication (#15880)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15880

The layer_norm reference was implemented twice. Removing one of them.

Reviewed By: dzhulgakov

Differential Revision: D13611232

fbshipit-source-id: cee96c78d3255c3a4e34300693bf9260cf096615
2019-01-14 17:59:37 -08:00
Jesse Hellemn
8964a2e6e6 Split Caffe2 CI into cmake-only and python builds (#15917)
Summary:
bypass-lint

- Change all Caffe2 builds to use setup.py instead of cmake
- Add a -cmake- Caffe2 build configuration that uses cmake and only builds cpp
- Move skipIfCI logic from onnx test scripts to the rest of CI logic
- Removal of old PYTHONPATH/LD_LIBRARY_PATH/etc. env management
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15917

Reviewed By: orionr

Differential Revision: D13637583

Pulled By: pjh5

fbshipit-source-id: c5c5639db0251ba12b6e4b51b2ac3b26a8953153
2019-01-14 15:20:44 -08:00
Sergei Nikolaev
a282378baf Caffe 2: Reshape Op upgrade (#15380)
Summary:
This is follow up on #13945 where we had to turn off some TRT tests because some ops were not ready to accept ONNX opset 9+ models. This PR fixes Reshape.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15380

Differential Revision: D13649825

Pulled By: houseroad

fbshipit-source-id: b72e62803de5b63cc001c3fe4b3bf64dfa996e94
2019-01-13 22:49:40 -08:00
Cheng,Penghui
926e718d5f Add/fallback some operators for mkl-dnn (#11696)
Summary:
Implementation LeakyRelu operator for mkl-dnn,the speed-up of a single operation is up to 10X on BDW.
Implementation rashape operator for mkl-dnn,it will resolve occasionally crash issue which use fallback reshape operator.
Implementation CreateBlobQueue and SafeEnqueueBlobs operators,it will resolve crash issue which use fallback operators.
Fallback CreateBlobsQueueDBOp,TensorProtosDBInput,CloseBlobsQueue operators.
Implement adam operator for mkl-dnn,the speed-up of a single operator is up to 6X on BDW.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11696

Reviewed By: yinghai

Differential Revision: D10100438

Pulled By: wesolwsk

fbshipit-source-id: 0b6e06897cc11e0a8e349d80a870b1e72e47f10d
2019-01-11 12:53:06 -08:00
Mickaël Schoentgen
71c6e24373 Fix several ResourceWarning: unclosed file (#15746)
Summary:
Hello,

This is a patch to fix `ResourceWarning: unclosed file`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15746

Differential Revision: D13587286

Pulled By: soumith

fbshipit-source-id: 08ac34c5b51d9334867f65a2927bff11511553f3
2019-01-09 15:36:53 -08:00
Andre Georg Holzner
961f829067 deduplicated code in elementwise_op_broadcast_test.py (#15865)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15865

factored out code used in tests for operators Add, Mul and Sub
into two new methods: a first one to generate the test vectors, a second
one to run the actual tests given a caffe2 and python operator.

Reviewed By: houseroad

Differential Revision: D13526955

fbshipit-source-id: 8970ba5a1305ca19a54a14b51816d4a19f19d678
2019-01-09 03:07:22 -08:00
Yinghai Lu
5fe2697655 Initialize tensor with fp32 in Caffe2Backend.prepare() (#15832)
Summary:
Fix https://github.com/pytorch/pytorch/issues/14104
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15832

Reviewed By: bddppq

Differential Revision: D13598332

Pulled By: yinghai

fbshipit-source-id: 3302ac47928974f49353c5da8af440e5c1716c22
2019-01-08 22:33:52 -08:00
David Carrillo Cisneros
2b22612289 Add NHWC support to Resize Operator (#15553)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15553

Add unit test and implementation of NHWC layout for Resize operator.

Also, add pragma parallel loop to old NCHWC layout.

Reviewed By: jspark1105

Differential Revision: D13540762

fbshipit-source-id: eebf252bf0d1efdff180a171d804181045f100a5
2019-01-08 16:44:17 -08:00
Yinghai Lu
c3a0000864 Support communicating with C2 protobuf in Onnxifi flow (#15472)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15472

Create a path to pass serialized C2 protobuf instead of ONNX during ONNXIFI flow

Reviewed By: houseroad

Differential Revision: D13536603

fbshipit-source-id: 7d016474f4beedbda480ed2e2c0004af7868aafe
2019-01-07 22:12:29 -08:00
Gu, Jinghui
49ba2cb796 Enable conv+add fusion, same as conv+sum (#15268)
Summary:
Enable conv+add fusion, same as conv+sum

Caution: only element-wise add is supported on IDEEP without scalar
broadcast. Otherwise, the fusion is illegal.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15268

Differential Revision: D13577375

Pulled By: yinghai

fbshipit-source-id: 92c9c4b667c5ca5f7a262a5bffaa8aa68eeff3bd
2019-01-07 14:42:45 -08:00
Gu, Jinghui
2ebeb33697 Fallback to CPU concat op to handle TensorCPU inputs (#15263)
Summary:
Fallback to CPU concat op to handle TensorCPU inputs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15263

Differential Revision: D13587030

Pulled By: yinghai

fbshipit-source-id: 010a8579d61c3beb8556eb92493a552b2ab0030c
2019-01-07 11:13:23 -08:00
Mickaël Schoentgen
04f5605ba1 Fix several DeprecationWarning: invalid escape sequence (#15733)
Summary:
Hello,

This is a little patch to fix `DeprecationWarning: invalid escape sequence`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15733

Differential Revision: D13587291

Pulled By: soumith

fbshipit-source-id: ce68db2de92ca7eaa42f78ca5ae6fbc1d4d90e05
2019-01-05 08:53:35 -08:00
Cheng,Penghui
1488c5dd03 support 0 size in any of the tensor dimensions in mkldnn (#15295)
Summary:
support 0 size in any of the tensor dimensions in mkldnn
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15295

Differential Revision: D13573747

Pulled By: yinghai

fbshipit-source-id: 5bf7a0b9e2567e80f44981a7823be5407fc94e53
2019-01-04 22:33:18 -08:00
Lu Fang
12e6c1ceeb Automatic update of fbcode/onnx to 8384c788939bc65463f9754b6a7a00b212b18ba1 (#15739)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15739

Previous import was 765f5ee823a67a866f4bd28a9860e81f3c811ce8

Included changes:
- **[8384c78](https://github.com/onnx/onnx/commit/8384c78)**: add constantofshape (#1582) <Rui Zhu>
- **[9afc06c](https://github.com/onnx/onnx/commit/9afc06c)**: Set symbol visibility to hidden for non-Windows (#1707) <Paul Jesse Hellemn>
- **[6f8a9f0](https://github.com/onnx/onnx/commit/6f8a9f0)**: Revert "Add NonMaxSupression operator (#1695)" (#1702) <Lu Fang>
- **[8b89544](https://github.com/onnx/onnx/commit/8b89544)**: Add NonMaxSupression operator (#1695) <Hector Li>
- **[0a7cc48](https://github.com/onnx/onnx/commit/0a7cc48)**: Add bfloat16 support. (#1699) <Dmitri Smirnov>
- **[da7c50c](https://github.com/onnx/onnx/commit/da7c50c)**: ONNX does not maintain versions for experimental ops (#1696) <Ke Zhang>
- **[0c8d857](https://github.com/onnx/onnx/commit/0c8d857)**: Correct type of value_info in Graph (#1694) <Maik Riechert>
- **[f612532](https://github.com/onnx/onnx/commit/f612532)**: Fix typos (#1686) <Eundoo Song>

Reviewed By: zrphercule

Differential Revision: D13581674

fbshipit-source-id: 8f8ee86a05a86fe99bf94509148c559ea3df1464
2019-01-04 15:56:55 -08:00
Jongsoo Park
1159302ab1 bug fix in 3d group conv (#15625)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15625

3D group conv (both NCHW and NHWC layout) was not correct.
Added group=2 in test_1d_convolution and test_3d_convolution in conv_test

Reviewed By: protonu

Differential Revision: D13562099

fbshipit-source-id: 586e8a7574a2764f2a3b559db6c2415b3ab90453
2019-01-03 09:46:49 -08:00
Jerry Zhang
3ea5a9a66d Remove PythonOp non-CPU path and PytorchOp (#15417)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15417

Right now the way we test whether Blob contains a CPU tensor is broken in ```PythonOpBase``` is broken, which means non-CPU path might never be taken.
Searching through the codebase, non-gpu path is used in PythonDLPack, and it is used in PytorchOp which is unused. So we'll remove non-gpu path in this diff.

Reviewed By: dzhulgakov

Differential Revision: D13495011

fbshipit-source-id: 9fe9537f05026d2a2cf7051efa81d184de722710
2019-01-02 16:36:37 -08:00
Jongsoo Park
bee6c6761e format conv_test.py to prepare D13562099 (#15632)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15632

Just formatting and a few lints.

Reviewed By: yinghai

Differential Revision: D13562403

fbshipit-source-id: c56f8ee61f68cdaccc0828a764ff729454f68259
2019-01-02 11:34:30 -08:00
Jongsoo Park
d53012b4fe add NCHW2NHWC and NHWC2NCHW in utils.py (#15588)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15588

Use NHWC2NCHW or NCHW2NHWC functions which is easier to understand compared to code using transpose and generalizable to non-2D convolutions.

Reviewed By: csummersea

Differential Revision: D13557674

fbshipit-source-id: c4fdb8850503ea58f6b17b188513ae2b29691ec0
2018-12-28 17:34:50 -08:00
Jongsoo Park
4e4ef0cffb add rowwise adagrad lp test (#15082)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15082

We didn't have unit test for low-precision rowwise adagrad

Reviewed By: chocjy

Differential Revision: D13300732

fbshipit-source-id: 46e7bdfc82c5a6855eeb6f653c0a96b0b3a20546
2018-12-22 10:25:39 -08:00
Jongsoo Park
e012b183dd handle empty inputs to SparseLengthsMean correctly (#15389)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15389

SparseLengthsMean was generating uninitialized data for empty inputs (lengths == 0). We should return zeros.
The unit tests were also not covering this special case which is fixed by this diff.

Reviewed By: salexspb

Differential Revision: D13515970

fbshipit-source-id: 3c35265638f64f13f0262cee930c94f8628005da
2018-12-21 22:20:14 -08:00
Bram Wasti
235d47760b Relax check on outputs (#15458)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15458

many nets in the wild seem to have outputs that are never produced by the net.

Reviewed By: ZolotukhinM

Differential Revision: D13534185

fbshipit-source-id: 2b23b39c28404c53f68868f3bf6df53c5fea9eab
2018-12-21 14:19:37 -08:00
Bram Wasti
ac506f5820 Back out "[nomnigraph][executor] computeChains with nomnigraph" (#15451)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15451

Original commit changeset: ccd050bfead6

Reviewed By: ilia-cher

Differential Revision: D13533161

fbshipit-source-id: 1d0dcd54c2e3875aab015f3e996693e67a449b87
2018-12-21 11:09:27 -08:00
Jongsoo Park
f52f68bcf9 format specialized_segment_ops_test.py to prepare D13515970 (#15408)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15408

Applied formatting to specialized_segment_ops_test.py to prepare D13515970

Reviewed By: salexspb

Differential Revision: D13520300

fbshipit-source-id: c3250b6abe8087c607f65ae60d1da61bd46c342b
2018-12-20 23:44:47 -08:00
Yinghai Lu
cb79e1b3a5 Clean up onnxifi transformation code (#15453)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15453

Just move things around to facilitate further development. No logic change.

Reviewed By: rdzhabarov

Differential Revision: D13533959

fbshipit-source-id: eebab1306939e802aacffb24a711d372fd67916c
2018-12-20 22:06:47 -08:00
Edward Yang
26b04523b1 Record Caffe2's current stream ID in c10_cuda. (#15174)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15174

Previously, Caffe2 maintained a separate per-thread per-device
current logical CUDA stream ID.  In this PR, we switch Caffe2 over
to using c10::Stream to manage the current stream, and also
manage the allocation of cudaStream_t objects.

This results in a slight behavior change: previously, Caffe2
would have been willing to allocate an arbitrary number of
CUDA streams, depending on how high the logical stream IDs
went.  The c10::Stream pool has a fixed number of streams, once
you exceed it, it wraps around.

Reviewed By: dzhulgakov

Differential Revision: D13451550

fbshipit-source-id: da6cf33ee026932a2d873835f6e090f7b8a7d8dc
2018-12-20 21:54:05 -08:00
Bram Wasti
055de167d5 computeChains with nomnigraph (#15366)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15366

swap the old implementation with a slightly easier one to understand

I ran the tests and compared the number of chains compared to the old algorithm.  This one outperforms on every test, but we have yet to see if that impacts performance at all.

old chain 34 nomnigraph chain 25
old chain 46 nomnigraph chain 34
old chain 228 nomnigraph chain 188
old chain 397 nomnigraph chain 338

Reviewed By: ilia-cher

Differential Revision: D13057451

fbshipit-source-id: ccd050bfead6eb94ab9c7b0a70b09a22c2b9e499
2018-12-19 15:04:23 -08:00
Bill Li
3681bf7cff add dense vector to id_list operator (#15090)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15090

as title
step 2 of the linked task

Reviewed By: ellie-wen

Differential Revision: D13425977

fbshipit-source-id: f3538ed68f42470ba39c5b779af764d4a5591a9d
2018-12-18 16:27:38 -08:00
Tristan Rice
e650a84872 caffe2/python/task: added __repr__ methods to all task definitions (#15250)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15250

This adds `__repr__` methods to all of the classes under task.py. This makes the objects much easier to interact with when using them in an interactive manner, such as in a Jupyter notebook.

The default `__repr__` method just returns the object ID which is very unhelpful.

Reviewed By: hanli0612

Differential Revision: D13475758

fbshipit-source-id: 6e1b166ec35163b9776c797b6a2e0d002560cd29
2018-12-17 16:02:16 -08:00
peter
216ab259fb Fix the missing caffe2 proto files for Windows (#15157)
Summary:
Fixes #15156
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15157

Differential Revision: D13490420

Pulled By: orionr

fbshipit-source-id: 4387d707f634a5975238af915b1befb2277f8ec7
2018-12-17 15:21:47 -08:00
rohithkrn
763b9954f3 FP16MomentumSGDUpdate Op fix and enable for ROCm (#15150)
Summary:
1. Fix a bug in FP16MomentumSGDUpdate operator
2. Enable operator for ROCm
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15150

Differential Revision: D13473145

Pulled By: bddppq

fbshipit-source-id: 4c5c5f30cb9bba658e3639dbe193fa08a304d306
2018-12-14 16:33:45 -08:00
Alexander Sidorov
e596d23137 Start unittesting our main observer (#15191)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15191

OSS:

just splitting out basic flags from a unit test. So I can extend them in another test where I need to add additional flags.

Reviewed By: yinghai

Differential Revision: D13159184

fbshipit-source-id: 9823e792cf0ed8d0379235c44564862b7d784845
2018-12-14 16:24:38 -08:00
bddppq
855d9e1f19 Run ONNX cuda backend test cases via ROCm
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15069

Differential Revision: D13427757

Pulled By: bddppq

fbshipit-source-id: ba0273d75986cd5b146f7041a83c63ddf9c6c0cf
2018-12-13 15:10:00 -08:00
Xianjie Chen
fabd23cb2d support casting to string (#15110)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15110

support casting to string on CPU

Reviewed By: intermilan

Differential Revision: D13429381

fbshipit-source-id: b737a1ba1237b10f692d5c42b42a544b94ba9fd1
2018-12-12 21:33:58 -08:00
Cheng,Penghui
1717ea1da0 Implementation of ChannelShuffle Op for MKLDNN (#15106)
Summary:
the speed-up of a single operation is up to 3X .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15106

Differential Revision: D13429596

Pulled By: bddppq

fbshipit-source-id: f8d987cafeac9bef9c3daf7e43ede8c6a4ee2ce5
2018-12-12 20:25:12 -08:00
Brett Koonce
d8260239a0 docs: minor spelling tweaks
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15148

Differential Revision: D13443708

Pulled By: suo

fbshipit-source-id: 5e3ec0afd3416ab8ce207f2d04105c49e1c04611
2018-12-12 18:17:14 -08:00
Jerry Zhang
63e77ab6c4 Move numa.{h, cc} to c10/util (#15024)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15024

Pull Request resolved: https://github.com/pytorch/pytorch/pull/14393

att

Reviewed By: dzhulgakov

Differential Revision: D13380559

fbshipit-source-id: abc3fc7321cf37323f756dfd614c7b41978734e4
2018-12-12 12:21:10 -08:00
Zhiping Xiu
1423c0d9f1 Add EmptyNameScope to allow you jump out from current scope. (#14631)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14631

adding a empty name scope to allow people jump out from current namescope.

This could be useful when you want to access blob from parent or sibling scope.

 Facebook:

e.g: we encoutered a potential usecase in D13124249 (it's a large diff, please search by EmptyNameScope in that diff), we need to access to a blob declared in root namescope from a device namescope (device namescope has been used by parallel_GPU API). `EmptyNameScope` can help us do that with ease.

I referenced to `EmptyDeviceScope` D6103412 while implementing this one.

Reviewed By: yinghai

Differential Revision: D13272240

fbshipit-source-id: d4cde5abcc2336e456b6c6ef086266ef94d86da8
2018-12-12 01:39:50 -08:00
bddppq
479481b6cb Remove linker and dlopen flags that allowed undefined symbols in rocm build (#15091)
Summary:
Previously the undefined symbols were caused by disabled_modules in tools/amd_build/disabled_features.json (now it's cleared).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15091

Differential Revision: D13429595

Pulled By: bddppq

fbshipit-source-id: b341e83f9e5a8d16440a364e837b045a8a4fd6e1
2018-12-11 23:23:47 -08:00
Daniel Ingram
5c2c40ad87 Add error type to raise statement
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15039

Differential Revision: D13419566

Pulled By: zou3519

fbshipit-source-id: f67a3aebce937e3e640e91e81eb3e184cfdf269c
2018-12-11 17:41:44 -08:00
Zachary DeVito
92314c83fa re-enable copy of python files, but be careful that the copy is only … (#14982)
Summary:
…done once

This allow no-op build to work correctly even when BUILD_CAFFE2_OPS is on.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14982

Differential Revision: D13413960

Pulled By: zdevito

fbshipit-source-id: 6e5412a8c375af8a47c76f548cdd31cff15f3853
2018-12-11 16:54:08 -08:00
TerryTsao
c2a754c58b Fix CMakeLists.txt for Int8 python bindings (#15047)
Summary:
Currently in caffe2, one cannot properly fetch the content of Int8 blobs.

Upon digging the source code, it turns out that the relevant source code is not being compiled. Adding the source to CMakeLists.txt fixes this issue.

First time ever doing a pull request. Please let me know if there's any rule I should follow. Thanks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15047

Differential Revision: D13417583

Pulled By: bddppq

fbshipit-source-id: dd39575971a3012635edbf97a045d80e4b62a8eb
2018-12-11 10:48:47 -08:00
Jongsoo Park
cff509e2b1 share code between adagrad and rowwise adagrad tests (#14692)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14692

Remove some code duplication

Reviewed By: chocjy

Differential Revision: D13296731

fbshipit-source-id: 5924e037ca64fc4b89234be922bc5ca47fb8bd32
2018-12-10 22:10:39 -08:00
bddppq
45dfc6764e Enable more caffe2 fp16 rocm tests (#15040)
Summary:
cc rohithkrn petrex
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15040

Reviewed By: houseroad

Differential Revision: D13413068

Pulled By: bddppq

fbshipit-source-id: b2967f16f8da0b9e80083138fb8632c14e9e9b63
2018-12-10 21:30:21 -08:00
Ilia Cherniavskii
e9cd781681 Back out "Revert D13043261: [caffe2] Task graph and task future abstractions in executor"
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15030

Reviewed By: bddppq

Differential Revision: D13408998

fbshipit-source-id: 9eb675e09fbc4829eab34df7aa660a0590816feb
2018-12-10 19:30:58 -08:00
rohithkrn
7e2b074219 Integrate rocBLAS fp16 api into Caffe2 (#14882)
Summary:
This PR integrates rocBLAS half and mixed precision APIs in to Caffe2.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14882

Differential Revision: D13407840

Pulled By: bddppq

fbshipit-source-id: 75cb0d74da066776fa66575f1d255e879d36121e
2018-12-10 17:54:06 -08:00
Junjie Bai
4a145cd95c Revert D13043261: [caffe2] Task graph and task future abstractions in executor
Differential Revision:
D13043261

Original commit changeset: d89424354aea

fbshipit-source-id: b307e3281c4d83b60ba2bfadcbcf69afb7a41412
2018-12-10 16:03:59 -08:00
Ilia Cherniavskii
029600813e Task graph and task future abstractions in executor
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14116

Reviewed By: dmudiger

Differential Revision: D13043261

fbshipit-source-id: d89424354aea14d1d14eb8320fb3aa34908a4e81
2018-12-10 14:28:56 -08:00
Jerry Zhang
a51fe386c8 caffe2/caffe2/contrib/script (#15007)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15007

Pull Request resolved: https://github.com/pytorch/pytorch/pull/14979

att

Reviewed By: dzhulgakov

Differential Revision: D13286191

fbshipit-source-id: b8a6bc7aea44487aea4dcf7f44c858fd30c6293c
2018-12-10 14:23:31 -08:00
Yiming Wu
a1494efdfa fix auto grad summing for IfOp where intermediate output needs renaming (#14772)
Summary:
fix auto grad summing for IfOp where intermediate output needs renaming.

Bug before this diff:
- we only renames the output of IfOp without changing the subnet ops output
- this results in blob not found error

the unittest provides an example
this diff fix that for IfOp
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14772

Differential Revision: D13327090

Pulled By: harouwu

fbshipit-source-id: ec40ee88526ace3619c54551e223dd71158a02f8
2018-12-09 08:26:46 -08:00
Your Name
5e06fa0baf ONNX changes to use int32_t (instead of enum) to store data type
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14926

Reviewed By: houseroad

Differential Revision: D13390642

Pulled By: bddppq

fbshipit-source-id: c2314b24d9384f188fda2b9a5cc16465ad39581e
2018-12-08 01:06:08 -08:00
Lu Fang
5be28ade66 Automatic update of fbcode/onnx to aca8473a40cf43f01958c81b648efcee7f3a755a (#14865)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14865

Previous import was 42804705bdbf179d1a98394008417e1392013547

Included changes:
- **[aca8473](https://github.com/onnx/onnx/commit/aca8473)**: Add Erf operator for computing error function (#1675) <bddppq>
- **[3fc82ca](https://github.com/onnx/onnx/commit/3fc82ca)**: Add IsNaN operator. (#1656) <Pranav Sharma>
- **[0685f01](https://github.com/onnx/onnx/commit/0685f01)**: Add Sign Op (#1658) <Rui Zhu>
- **[2a8fae8](https://github.com/onnx/onnx/commit/2a8fae8)**: Fix unused var warning (#1669) <Yinghai Lu>
- **[e212833](https://github.com/onnx/onnx/commit/e212833)**: Update scan (#1653) <G. Ramalingam>

Reviewed By: zrphercule

Differential Revision: D13370727

fbshipit-source-id: 13a93d5acc8d4758f682278ea162ec9124ced22d
2018-12-07 17:37:42 -08:00
rohithkrn
11a9248d01 Enable fp16 for MIOPEN operators in Caffe2 (#14905)
Summary:
This PR enables fp16 MIOPEN operators in Caffe2.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14905

Differential Revision: D13383439

Pulled By: bddppq

fbshipit-source-id: 840afa8d08bef2952ca0039dee2423f1542bb330
2018-12-07 17:26:44 -08:00
Sergei Nikolaev
a0ee3a279c USE_TENSORRT support and TensorRT 5 compatibility
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13945

Differential Revision: D13317525

Pulled By: yinghai

fbshipit-source-id: 8630dfec1bbc5aac19539e344e7c38a7fd8b051d
2018-12-07 14:01:11 -08:00
Orion Reblitz-Richardson
febc7ff99f Add __init__.py so files get picked up on install (#14898)
Summary:
This will let us install tests and other Caffe2 python code as a part of running Caffe2 tests in PyTorch.

Broken out of https://github.com/pytorch/pytorch/pull/13733/

cc pjh5 yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14898

Reviewed By: pjh5

Differential Revision: D13381123

Pulled By: orionr

fbshipit-source-id: 0ec96629b0570f6cc2abb1d1d6fce084e7464dbe
2018-12-07 13:40:23 -08:00
PenghuiCheng
939877bf4b Implementation of WeightedSum op for mkl-dnn and fix FC op output shape issue.
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14407

Reviewed By: yinghai

Differential Revision: D13364364

Pulled By: wesolwsk

fbshipit-source-id: e69bcd1bc52e35b2f0e45e5dc40184f1bd66605d
2018-12-07 12:35:19 -08:00
Yudong Guang
265b55d028 Revert D13205604: Move numa.{h, cc} to c10/util
Differential Revision:
D13205604

Original commit changeset: 54166492d318

fbshipit-source-id: 89b6833518c0b554668c88ae38d97fbc47e2de17
2018-12-07 10:01:25 -08:00
Jerry Zhang
1d111853ae Move numa.{h, cc} to c10/util (#14393)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14393

att

Reviewed By: ezyang

Differential Revision: D13205604

fbshipit-source-id: 54166492d31827b0343ed070cc36a825dd86e2ed
2018-12-06 11:30:13 -08:00
lcskrishna
12addc64a6 Fixed MIOpen RNN Segfault issue and enabled RNN test (#14810)
Summary:
This pull request contains changes for:
1. Added MIOpen RNN API miopenGetRNNLayerBiasSize and miopenGetRNNLayerParamSize.
2. Fixed usage of API miopenGetRNNLayerParam.
3. Modifying the RNN test to run using MIOpen engine.

Differential Revision: D13355699

Pulled By: bddppq

fbshipit-source-id: 6f750657f8049c5446eca893880b397804120b69
2018-12-05 23:54:31 -08:00
Huan Gui
ba287eebca Fix clip gradient with empty input (#14709)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14709

As titled

Reviewed By: Wakeupbuddy

Differential Revision: D13305554

fbshipit-source-id: 380062d4b0e4f9dc0207a27766cac7b8d05384d5
2018-12-05 22:53:25 -08:00
Jerry Zhang
a597c0ca05 Add inplace FeedTensor for python frontend (#14512)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14512

att

Reviewed By: dzhulgakov

Differential Revision: D13243278

fbshipit-source-id: 78af417d0fcd9b9791ee839d62095903e49205cb
2018-12-04 12:45:11 -08:00
Michael Antonov
773f4d8081 Implements Gather operator for arbitrary axis, sharing the code with BatchGather. (#13756)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13756

This implements general Gather operator for arbitrary axis, sharing the code with BatchGather.
 - CPU gather & batch gather logic is now shared through caffe2::gather_helper, for any axis.
 - Shared CUDA kernel moved to gather_op.cuh, for any axis.
 - Gradients of axis > 0 delegate to BatchGatherGradientOp which now has axis argument.
 - BatchGatherOp doc strings updated to have correct rank (q + (r -1)) and output.
 - Added tests for axis == 2.

GatherOp supports index wrapping for axis == 0 by default, which was earlier for ONNX.
This diff also extends it to work in Cuda kernel. Added "wrap_indices" argument which specifies
wheather this wrapping should be done; set it to true if you'd like wrapping for any axis.

TBD: Update gradients to support negative indices (separate diff).
TBD: Once we have operator versioning, we'd like to update GatherOp to NOT support axis 0 wrapping
by default, but rather do it only if wrap_indices is set.

Reviewed By: dzhulgakov

Differential Revision: D12983815

fbshipit-source-id: 8add9d67b47fe8c5ba7a335f581ca0530b205cd7
2018-12-04 11:54:28 -08:00
Lu Fang
44894915d6 Automatic update of fbcode/onnx to 6b34743d2e361bbc0acb29dd73536478cb92562e (#14637)
Summary:
Previous import was f461f7aad9987635b4aff108620ed7918f002d19

Included changes:
- **[6b34743](https://github.com/onnx/onnx/commit/6b34743)**: fix the const map initializatoin (#1662) <Lu Fang>
- **[ae80999](https://github.com/onnx/onnx/commit/ae80999)**: Fuse Pad into Conv optimizer (#1580) <vloncar>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14637

Differential Revision: D13281338

Pulled By: houseroad

fbshipit-source-id: c31429914bf5954fdc85e0c02168836ef47d635c
2018-12-03 20:11:17 -08:00
Yan Zhu
aeb38cfcea cuda implementation for PackSegment to support presence mask (#14635)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14635

as title

Reviewed By: enosair

Differential Revision: D13254097

fbshipit-source-id: b9f40109e2889907c925f9a4df9da14f67f45f38
2018-11-30 16:54:10 -08:00
Lu Fang
2752ad8045 Automatic update of fbcode/onnx to f461f7aad9987635b4aff108620ed7918f002d19 (#14568)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14568

Previous import was 882c5283c54345d131e8fe5c859e4844dcf7ca8e

Included changes:
- **[f461f7a](https://github.com/onnx/onnx/commit/f461f7a)**: Show the op's type and name when the shape inference is failed. (#1623) <Jerry>
- **[ab8aaf9](https://github.com/onnx/onnx/commit/ab8aaf9)**: Add scan test case (#1586) <G. Ramalingam>
- **[c95357e](https://github.com/onnx/onnx/commit/c95357e)**: link the tutorial (#1650) <Lu Fang>
- **[d7e2420](https://github.com/onnx/onnx/commit/d7e2420)**: Upgrade label encoder to support more input types (#1596) <Wei-Sheng Chin>
- **[6425108](https://github.com/onnx/onnx/commit/6425108)**: Add Doc about Adding New Operator into ONNX (#1647) <Lu Fang>
- **[295889c](https://github.com/onnx/onnx/commit/295889c)**: use an empty initializer to create map (#1643) <Lu Fang>
- **[e38f3ec](https://github.com/onnx/onnx/commit/e38f3ec)**: Remove redundant const (#1639) <daquexian>
- **[ea694bf](https://github.com/onnx/onnx/commit/ea694bf)**: implement fuse reduce->unsqueeze + fix assumption in nop_dropout pass (#1565) <Armen>
- **[6db386e](https://github.com/onnx/onnx/commit/6db386e)**: make output shape clear enough for Softmax family (#1634) <Lu Fang>
- **[2b67c6e](https://github.com/onnx/onnx/commit/2b67c6e)**: fix batchnorm doc (#1633) <Lu Fang>
- **[c901784](https://github.com/onnx/onnx/commit/c901784)**: remove inappropriate consts (#1632) <Lu Fang>
- **[de82119](https://github.com/onnx/onnx/commit/de82119)**: Shape inference fix for broadcast, concat and scan (#1594) <KeDengMS>
- **[d7ffe3b](https://github.com/onnx/onnx/commit/d7ffe3b)**: Update Optimizer Docs (#1607) <Armen>
- **[d09d139](https://github.com/onnx/onnx/commit/d09d139)**: mark PROTOBUF_INCLUDE_DIRS as BUILD_INTERFACE (#1466) <Yuta Okamoto>
- **[eb4b7c2](https://github.com/onnx/onnx/commit/eb4b7c2)**: allow variadic parameters of different types (#1615) <G. Ramalingam>
- **[4166246](https://github.com/onnx/onnx/commit/4166246)**: Fix onnxifi test (#1617) <Yinghai Lu>
- **[6706a4d](https://github.com/onnx/onnx/commit/6706a4d)**: Fix a bug in vector address access (#1598) <Raymond Yang>
- **[ae39866](https://github.com/onnx/onnx/commit/ae39866)**: Separate types of inputs 1 and 2 in OneHot op. (#1610) <Spandan Tiwari>
- **[45ba661](https://github.com/onnx/onnx/commit/45ba661)**: Handle new types in the switch. (#1608) <Dmitri Smirnov>
- **[14853b6](https://github.com/onnx/onnx/commit/14853b6)**: Bump docker image version to 230 used in CircleCI (#1606) <bddppq>
- **[e0993b8](https://github.com/onnx/onnx/commit/e0993b8)**: [onnxifi] Make sure that backend handles run async. (#1599) <Roman Dzhabarov>
- **[e6965cc](https://github.com/onnx/onnx/commit/e6965cc)**: Introduce SparseTensor ML proto (#1554) <Dmitri Smirnov>
- **[75b782f](https://github.com/onnx/onnx/commit/75b782f)**: In driver test check the return status of onnxGetBackendIDs (#1597) <bddppq>
- **[c05b364](https://github.com/onnx/onnx/commit/c05b364)**: Make CI log less verbose (#1595) <bddppq>
- **[fa568e4](https://github.com/onnx/onnx/commit/fa568e4)**: Loop type shape inferencing (#1591) <Scott McKay>
- **[937e64c](https://github.com/onnx/onnx/commit/937e64c)**: add uint8 (#1590) <Lu Fang>
- **[f86e951](https://github.com/onnx/onnx/commit/f86e951)**: Add domain as an optional parameter for make_node function (#1588) <Young Kim>
- **[ff45588](https://github.com/onnx/onnx/commit/ff45588)**: Remove unreachable code in shape_inference.h (#1585) <Changming Sun>
- **[f7dcad0](https://github.com/onnx/onnx/commit/f7dcad0)**: Add several hyperbolic function ops. (#1499) <Sergii Dymchenko>
- **[a60ac7d](https://github.com/onnx/onnx/commit/a60ac7d)**: Add OneHot op to ONNX. (#1567) <Spandan Tiwari>
- **[f6c3a7e](https://github.com/onnx/onnx/commit/f6c3a7e)**: [compiler flag] Issue a warning if class has virtual method but missing virtual dtor. (#1583) <Roman Dzhabarov>
- **[88d1784](https://github.com/onnx/onnx/commit/88d1784)**: Fix MaxUnpool shape inference when output_shape is provided as input (#1578) <Spandan Tiwari>
- **[20041b7](https://github.com/onnx/onnx/commit/20041b7)**: Add type shape inferencing for the If operator (#1571) <Scott McKay>
- **[d6c4c75](https://github.com/onnx/onnx/commit/d6c4c75)**: Add a virtual destructor to GraphInferencer (#1574) <Changming Sun>
- **[a339598](https://github.com/onnx/onnx/commit/a339598)**: fix ConvTranspose spec (#1566) <Wenhao Hu>

Reviewed By: zrphercule

Differential Revision: D13263831

fbshipit-source-id: a2ff22c6454e2430429e5a7d18d21661a7ffb0cb
2018-11-29 16:31:56 -08:00
rohithkrn
0d663cec30 Unify cuda and hip device types in Caffe2 python front end (#14221)
Summary:
Goal of this PR is to unify cuda and hip device types in caffe2 python front end.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14221

Differential Revision: D13148564

Pulled By: bddppq

fbshipit-source-id: ef9bd2c7d238200165f217097ac5727e686d887b
2018-11-29 14:00:16 -08:00
Dmytro Dzhulgakov
0cfbbceac3 Change Tensor::CopyFrom to a simple double dispatch (#14268)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14268

Removes the need for Context in Tensor by doing simple dispatch for CopyBytes. It'd eventually be subsumed by Roy Li's changes of proper copy_ op, but before that is done, let's get a clear logic of how copies are implemented and clean up some craft in CopyFrom implementation.

Note, that with these changes, one can probably can get rid of Context::CopyFromCPU/CopyToCPU, but it's a matter for follow up diffs.

This diff doesn't change the API of Tensor yet, but relies on the fact that passing `Context` to CopyFrom makes copy async if the device is CUDA and doesn't have any effect otherwise (that's how Context methods are implemented).

This doesn't change semantics of copy async implementation - as before it blindly calls cudaMemcpyAsync which probably means that it can be misused if invoked separately outside of operator body. I'll leave it for the follow up copy_ unification.

For Extend() we always do async copy - it makes sense as it's an in-place device-device operation and only any further op would be observable.

Note: there are now three ways of invoking copy in C2 code - templated CopyBytes, virtual CopyFromCPU/etc, and double-dispatch free method here. Hopefully we can get rid of the second one.

Also, please advise whether it's c10-worthy :)

Reviewed By: ezyang

Differential Revision: D13117987

fbshipit-source-id: a6772d6dcf3effaf06717da3a656fc9873b310b5
2018-11-28 15:45:37 -08:00
Jiyan Yang
a2fcd4dee5 Ensure FP16 rowwise Adagrad can be run
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12317

Reviewed By: hyuen

Differential Revision: D10190778

fbshipit-source-id: 720a9aaa4e6b1736023d8c6326a613e4ea592b31
2018-11-28 02:15:36 -08:00
Jiyan Yang
0199d59d3a Resubmit: Set the correct engine name for position weighted pooling when fp16 is used for training
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13768

Reviewed By: xianjiec

Differential Revision: D12996103

fbshipit-source-id: 5ca4cda4210f68ece2b5d6eced8cf52ee91fb36f
2018-11-27 14:51:56 -08:00
Hassan Eslami
e392d428b1 Allowing TaskGroups to carry remote nets (#14342)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14342

Sometimes, when we are creating a TaskGroup, we are in fact creating a TaskGroup for a distributed job. In some cases, we may want to register a few nets as "remote" to a TaskGroup. The remote net should have sufficient attributes on where they should be executed later on.

This diff adds the remote net attribute to the TaskGroup class. It exposes two minimal functionalities: adding a remote net, and getting all remote nets added to a TaskGroup.

Reviewed By: d4l3k

Differential Revision: D13188320

fbshipit-source-id: efe947aec30817e9512a5e18be985713b9356bdc
2018-11-27 13:34:11 -08:00
Kevin Chen
b18063b39a Fix caffe2 => onnx exporter for ConvTranspose (#14143)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14143

ConvTranspose has a per-operator attribute rename, which meant that the
global attribute rename for kernels => kernel_shape was not applied.
Changing the behavior so that the global renames always apply, but per-op
renames can override those for specific attributes.

Note: The python frontend path isn't actually used for ConvTranspose, but I
thought it would be good to make it consistent.

Reviewed By: yinghai

Differential Revision: D13113395

fbshipit-source-id: cd3f124b4b5c753a506d297138b7d002b51bfb38
2018-11-26 15:51:42 -08:00
Jerry Zhang
735cd06536 FeedTensor returns a Tensor (#14196)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14196

Pull Request resolved: https://github.com/pytorch/pytorch/pull/13641

FeedTensor function used to take a pointer to Tensor and feed the content using Resize
and mutable_data, but since Tensor is a pointer now, we can just return a Tensor instead.

Reviewed By: dzhulgakov

Differential Revision: D13091163

fbshipit-source-id: 9abf2fd320baca76e050530c500dd29f8e2d0211
2018-11-26 13:05:44 -08:00
Huan Gui
60e7d04961 Add Recency Weighted into SparseLookup (#14291)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14291

Add RecencyWeighted into SparseLookup.

Reviewed By: Wakeupbuddy

Differential Revision: D13147738

fbshipit-source-id: de5dc3aaee8ce7d41c6d30d2ff47e9786a7fa4da
2018-11-24 02:43:31 -08:00
Yinghai Lu
f79fb58744 Make sure we bind input/output of Onnxifi op positionally (#14214)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14214

This is to pick up the residual task of T36325466 to make sure that input/output binding of c2 Onnxifi op is positional.

Reviewed By: dzhulgakov

Differential Revision: D13134470

fbshipit-source-id: d1b916dade65c79133b86507cd54ea5166fa6810
2018-11-22 00:31:01 -08:00
Gu, Jinghui
60963c2ecb Add "axis" and "axis_w" arguments in FC to support customized axix to reduce dim. (#12971)
Summary:
Add "axis" and "axis_w" arguments in FC to support customized axix to reduce dim.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12971

Reviewed By: bddppq

Differential Revision: D12850675

Pulled By: yinghai

fbshipit-source-id: f1cde163201bd7add53b8475329db1f038a73019
2018-11-21 15:44:50 -08:00
Hui Wu
acd7811e33 Add sigmoid op based on MKL-DNN
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13097

Differential Revision: D13105366

Pulled By: yinghai

fbshipit-source-id: d156e8fd519baeecf61c25dcd8fa2c2fa7351ef4
2018-11-19 22:56:35 -08:00
zrphercule
03a02b6fd5 Fix a bug in test case of onnx::If
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14209

Differential Revision: D13132607

Pulled By: zrphercule

fbshipit-source-id: b7f7ccc6a6cbdeb57a7f88a1971d15dd81e6fc81
2018-11-19 18:46:21 -08:00
Junjie Bai
0d7a986da1 Change hip filename extension to .hip (#14036)
Summary:
xw285cornell

- To make hip files to have unique filename extension we change hip files from _hip.cc to .hip (it's the only blessing option other than .cu in hipcc 3d51a1fb01/bin/hipcc (L552)).
- Change to use host compiler to compile .cc|.cpp files. Previously we use hcc to compile them which is unnecessary
- Change the hipify script to not replace "gpu" with "hip" in the filename of the generated hipified files. Previously we do this because hcc has a bug when linking files that have same filename. We have now changed to use host linker to do linking so this is unnecessary anymore.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14036

Reviewed By: xw285cornell

Differential Revision: D13091813

Pulled By: bddppq

fbshipit-source-id: ea3d887751d8abb39d75f5d5104aa66ce66b9ee0
2018-11-16 11:55:59 -08:00
Duc Ngo
c7a247facf nomnigraph - support subgraph visualization (#13795)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13795

Add ability for dot string generation for a single subgraph and python bindings (which is pretty useful for model exploration in Python)
Restructure DotGenerator class a bit to make it easy to implement this feature

Reviewed By: bwasti

Differential Revision: D13010512

fbshipit-source-id: 825665438394b7e6968ab6da167b477af82a7b62
2018-11-16 08:19:20 -08:00
Duc Ngo
d7b95dda51 nomnigraph - easy - expose hasProduce(NodeRef) to python (#14075)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14075

Expose hasProduce(NodeRef) to python

Reviewed By: bwasti

Differential Revision: D13092930

fbshipit-source-id: f1ec06e73e0f5f6a16ad0cbb7d2e3e499a861d8e
2018-11-16 08:19:18 -08:00
Duc Ngo
e7f5fceb99 nomnigraph - easy - expose inducesEdges and addNode to python's NNSubgraph (#14074)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14074

expose inducesEdges and addNode to python's NNSubgraph. This make it easy to manually construct a NNSubgraph in python

Reviewed By: bwasti

Differential Revision: D13092885

fbshipit-source-id: a94ed0b318162e27e3a4b5a4954eb6d169da7405
2018-11-16 08:19:16 -08:00
Parth Raichura
3808e9fad3 Caffe2: Fix for creating entries of external_input in predic_net (#12979)
Summary:
Currently after performing export it gives two entries of externel_input
  of input data in predict_net proto because it extends the externel_input
  twice once seperately using input blob and one it is extendind all the entries
  of external_input from proto in which input blob is already included

Signed-off-by: Parth Raichura <parth.raichura@softnautics.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12979

Differential Revision: D12916349

Pulled By: soumith

fbshipit-source-id: 4d4a1c68c0936f8de3f4e380aea1393fe193cd2d
2018-11-15 22:33:50 -08:00
Matthew Brandyberry
c5afad5579 Fix skip logic in caffe_translator_test.py (#13627)
Summary:
Avoid false failure by checking for the presence of the test data in setup.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13627

Differential Revision: D13090324

Pulled By: ezyang

fbshipit-source-id: e85571943d168c0007212d7b1a5b99ffa0c39235
2018-11-15 16:45:49 -08:00
Ilia Cherniavskii
0e93500841 Remove async_polling (#13825)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13825

async_polling was an intermediate step towards async_scheduling and is not used

Reviewed By: yinghai

Differential Revision: D13019059

fbshipit-source-id: eee6ba53e7f476ddb481afba3bf1768303864d32
2018-11-15 16:23:15 -08:00
Edward Yang
3fbb753512 Revert D12873145: [pt1][tensor][refactor] FeedTensor returns a Tensor
Differential Revision:
D12873145

Original commit changeset: 653735c20d61

fbshipit-source-id: aa6e40a6a24c6f90acbe87b32b3be0020e2584f8
2018-11-15 14:52:46 -08:00
Yan Zhu
2356c8d542 device inference for Adam (#13990)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13990

to make sure ITER blob lives on CPU.

Reviewed By: xianjiec

Differential Revision: D13056070

fbshipit-source-id: 148edbf745e50e886da3eb99d4e485d11c1924e2
2018-11-14 17:21:08 -08:00
Ashish
f4e502a8c5 Added MIOpen conv transpose op (#13938)
Summary:
This pull request contains changes for:
1. Removing ConvTranspose related changes from caffe2/operators/hip/conv_op_miopen.cc
2. Adding the file caffe2/operators/hip/conv_transpose_op_miopen.cc
3. Modifying the tests to run convTranspose op using MIOpen engine

Differential Revision: D13055099

Pulled By: bddppq

fbshipit-source-id: ca284f8f9a073005b22013c375cc958257815865
2018-11-13 21:01:52 -08:00
Shuting Wang
23e19ebfa7 add non expotential emphasis loss to Lambdarank
Summary: Currently Lambdarank applies exponential emphasis on relevance, i.e., g=2^rel when calculating dcg, this diff adds options that supports g=rel in the loss function.

Reviewed By: itomatik

Differential Revision: D9891514

fbshipit-source-id: 64730d467a665670edd37e6dc1c077987991d1a8
2018-11-13 14:54:04 -08:00
Jerry Zhang
266bb8bf30 FeedTensor returns a Tensor (#13641)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13641

FeedTensor function used to take a pointer to Tensor and feed the content using Resize
and mutable_data, but since Tensor is a pointer now, we can just return a Tensor instead.

Reviewed By: ezyang

Differential Revision: D12873145

fbshipit-source-id: 653735c20d611ff6ac9e380d8b3c721cb396a28f
2018-11-13 10:50:32 -08:00
Yinghai Lu
a7eee0a1e9 Add Reshape if there is add_axis when exporting C2 concat (#13798)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13798

The semantics of C2 and ONNX Concat is a bit different. C2 concat accepts "add_axis" arg and will raise the dim if so. It's equivalent of attaching a Reshape after plain concat in ONNX.

Reviewed By: rdzhabarov

Differential Revision: D13012867

fbshipit-source-id: da23e555bae709fd2a373b04dcb9db4e984ae315
2018-11-12 22:27:49 -08:00
Jesse Hellemn
1600649792 Fix for nightly builds (#13779)
Summary:
Being tested on nightlies manually.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13779

Reviewed By: yinghai

Differential Revision: D13001930

Pulled By: pjh5

fbshipit-source-id: 954eaabe052914b7b23c74e922666bf9dbfb630a
2018-11-12 16:38:14 -08:00
Bram Wasti
b052fe6c2f Upgrade DLPack
Summary: Needed to use TVM

Reviewed By: ajtulloch

Differential Revision: D12994038

fbshipit-source-id: f0b6c48a43a87fac37fcef73b78026d8384cd022
2018-11-12 15:59:46 -08:00
Bram Wasti
8480fe0105 Fix up creation of unique data nodes
Summary:
There was a bug in the uniqueness check that only made the first run
unique

Reviewed By: duc0

Differential Revision: D13013504

fbshipit-source-id: ecf7526d0fafd7968f1301734123f93968efef46
2018-11-12 15:37:08 -08:00
Yan Zhu
003f97cefa fc layer accept axis argument (#13822)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13822

as title

Reviewed By: xianjiec

Differential Revision: D12996338

fbshipit-source-id: 1aa61e71e2d79535325ea7034c82e1cb6bf3a9f6
2018-11-11 13:44:57 -08:00
Yinghai Lu
d97ac82bf5 Back out "Revert D12967258: Support more data types in ONNXIFI transform" (#13812)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13812

Original commit changeset: 2cf95bdc5ed8

Looks like in iOS, `uint64_t` is not the same as `size_t`. :( Fixed it here.

Reviewed By: houseroad

Differential Revision: D13017390

fbshipit-source-id: d33854ce341225aba372fb945c3704edc14f9411
2018-11-10 20:00:34 -08:00
Soumith Chintala
7c02f285dc Revert D12967258: Support more data types in ONNXIFI transform
Differential Revision:
D12967258

Original commit changeset: 688076e6f504

fbshipit-source-id: 2cf95bdc5ed8f1e13646bc5cf8139bdc516861d7
2018-11-10 12:34:31 -08:00
Yinghai Lu
5923d76f96 Support more data types in ONNXIFI transform (#13745)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13745

We need to support types beside `int64` and `float`.

Reviewed By: bddppq, rdzhabarov

Differential Revision: D12967258

fbshipit-source-id: 688076e6f504b2bf24bba89714df87a678c5638a
2018-11-10 10:41:01 -08:00
Yan Shang
c85463fc74 Allow Gather to handle empty data (#13781)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13781

allow Gather Op to handle empty data.

Reviewed By: intermilan

Differential Revision: D13001267

fbshipit-source-id: 633c8471b637c56be8f6574f9bf9430785073977
2018-11-10 10:00:47 -08:00
Ansha Yu
e3e6ca1102 operator serialized test coverage summary document (#13703)
Summary:
Add a markdown document summarizing the coverage of serialized operator tests. This currently only takes into account what has been covered by the tests with respect to the entire registry of c2 operators.

Next, we will break down the coverage by which operators have unit tests associated with them, which have hypothesis tests, and which have tests more specifically calling assertReferenceChecks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13703

Reviewed By: dzhulgakov

Differential Revision: D12970810

Pulled By: ajyu

fbshipit-source-id: 4f0cd057b1cf734371333e24d26cbab630a170e1
2018-11-09 15:04:08 -08:00
Gu, Jinghui
d01cb70497 build with mkl-dnn by default (#13303)
Summary:
build with mkl-dnn by default
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13303

Reviewed By: yinghai

Differential Revision: D12979633

Pulled By: orionr

fbshipit-source-id: 00d23fa27c0d13e82f7e5acb3ebd00ed7ba1d5dc
2018-11-08 11:18:27 -08:00
Yinghai Lu
8581d3ec67 Allow blacklist ops in onnxifi transform
Differential Revision: D12945523

fbshipit-source-id: cf5055652591bd1dd8d4be92b7fd6a40a0764536
2018-11-08 09:59:03 -08:00
Xiaoqiang Zheng
de41d1ae0b Enable junk fill for the default CPU allocator (#13377)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13377

* Enable junk fill for the default CPU allocator. The first diff only enables this for the tests. A second diff will change the default of zero-fill to false.
* Fix tests to use 64-bit counters that IterOp and LearningRateOp demands.
* Fix kernels that uses uninitialized memory.

Reviewed By: salexspb

Differential Revision: D10866512

fbshipit-source-id: 17860e77e63a203edf46d0da0335608f77884821
2018-11-08 00:02:37 -08:00
François Garillot
edd2e38023 Clean up a couple of items in the C2 test scaffolding (WIP) (#7847)
Summary:
- Py3 compatibility
- utility functions refactoring
Pull Request resolved: https://github.com/pytorch/pytorch/pull/7847

Reviewed By: pietern

Differential Revision: D9355096

Pulled By: huitseeker

fbshipit-source-id: 8e78faa937488c5299714f78075d7cadb1b2490c
2018-11-07 09:16:13 -08:00
Jerry Zhang
508f676c50 Rename ndim() -> dim() - 5/6
Summary:
Codemod generated with clangr shard mode, 50 files per diff,
clangr code(ndim()->dim()): diffusion/FBS/browse/master/fbcode/caffe2/caffe2/fb/codemods/TensorMethodRename.cpp

Reviewed By: salexspb

Differential Revision: D12935787

fbshipit-source-id: 303d71d3eb050789af2ab9575e5dcc48f6037086
2018-11-06 16:38:35 -08:00
Pradeep Dorairaj
76c1b5cd79 Fix overflow error in stats_put_ops
Summary:
I was hitting this error:

caffe2/caffe2/operators/stats_put_ops.h:66:25: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'

So, the assignment from int64_t to float loses some precision and because of that we overflow.

Reproduced this issue with this diff D12945013

Reviewed By: mlappelbaum, jdshi-fb

Differential Revision: D12927086

fbshipit-source-id: 7eae7fe25ab49d5ac15279335bd5b1fa89d6e683
2018-11-06 15:41:51 -08:00
Junjie Bai
95ca66763d Add math functions overloaded over different numeric types for cuda and hip (#13602)
Summary:
petrex ashishfarmer rohithkrn iotamudelta
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13602

Reviewed By: dzhulgakov

Differential Revision: D12935797

Pulled By: bddppq

fbshipit-source-id: a49ec66fb60bfd947c63dd2133d431884df62235
2018-11-06 01:40:31 -08:00
Hong Li
d03c6ba50d Adding Fetching Real number representation
Summary: Adding Fetching Real number representation for int8 tensor in workpace.py

Reviewed By: harouwu

Differential Revision: D12936556

fbshipit-source-id: f8756a37bce21c93d44d52faf5da9c9bd6473f4a
2018-11-05 23:35:24 -08:00
zrphercule
02d3787a19 Support new upsample in symbolic, caffe2 backend & caffe2 frontend (#13272)
Summary:
We updated the description of upsample_op in onnx: https://github.com/onnx/onnx/pull/1467
Therefore, we need to support the new upsample_op in caffe2-onnx backend as well.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13272

Reviewed By: houseroad

Differential Revision: D12833656

Pulled By: zrphercule

fbshipit-source-id: 21af5282abaae12d2d044e4018a2b152aff79917
2018-11-05 19:13:57 -08:00
Jongsoo Park
54e8623d26 3D Conv in NHWC layout (#12733)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12733

Conv in NHWC layout only works for 2D images. This has been a pain point when implementing quantized 3D convolution because we need NHWC layout for best performance (note that NHWC layout in general gives better performance in CPU not just for quantized operators). For example, our quantized ops have a functionality to measure quantized error operator by operator but this needs running a shadow fp32 operator, but this is not easy when there's no 3D conv in NHWC layout is available (currently we're doing layout conversion on the fly for the shadow fp32 operator which is error prone). Some of Caffe2 frameworks like brew generates error when we try to create a 3D conv op in NHWC layout. This was also a blocker for using aibench because aibench is using brew.

i-am-not-moving-c2-to-c10

Reviewed By: houseroad

Differential Revision: D10333829

fbshipit-source-id: 2d203ee1db833cd3f9d39353219e3894b46c4389
2018-11-04 21:50:09 -08:00
Jongsoo Park
8be0efaa8c omit group conv NHWC test for HIP (#13554)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13554

D10233252 broke ROCM test.
We don't have group conv in NHWC for hip yet and this diff omits related tests.

Reviewed By: hyuen

Differential Revision: D12917880

fbshipit-source-id: 9baf36a8cb061ee8cf393b2c438a2d1460ce5cd8
2018-11-03 21:18:23 -07:00
Jongsoo Park
2bc6a7a260 enable group conv test in NHWC layout in CPU (#12428)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12428

Group conv in NHWC layout was enabled in CPU after D7547497.
In D7547497, unit test of group conv in NHWC layout in CPU was enabled in group_conv_test.py but not in conv_test.py . This diff also enables it in conv_test.py .

Reviewed By: BIT-silence

Differential Revision: D10233252

fbshipit-source-id: aeeaf3eedc60e1cf6321b5a1dbe6a561e3aacbde
2018-11-03 11:58:51 -07:00
Junjie Bai
da029ca042 Skip Conv1D tests for MIOPEN (#13512)
Summary:
miopen currently only supports 2d

Pull Request resolved: https://github.com/pytorch/pytorch/pull/13512

Differential Revision: D12903307

Pulled By: bddppq

fbshipit-source-id: a8b0f0580a1859f1e0c1518907406abf013c4c8c
2018-11-02 11:38:26 -07:00
Sergei Nikolaev
61a2d47ec6 Special handling for 1D covolutional kernels in cuDNN flavor of conv_op. (#12902)
Summary:
Essentially makes cuDNN to think of those kernels like of Nx1 ones.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12902

Reviewed By: BIT-silence

Differential Revision: D10852862

Pulled By: soumith

fbshipit-source-id: 7416cf6d131177340d21cbf1d42c1daa6c7cad8c
2018-11-02 07:08:23 -07:00
Nim Arora
81438f1220 Add transpose network pass (#13437)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13437

revert
transform the NCHW Convolution operators to NHWC and the tensors around these operators

Reviewed By: bwasti

Differential Revision: D12871789

fbshipit-source-id: 6509a29fa1654424d22904df0d3e60f8cd9c0ec7
2018-11-01 14:27:07 -07:00
Nim Arora
a1728602da Convert Arguments to dictionary (#13436)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13436

revert
Add a utility function to convert a list of caffe2_pb2.Argument to a dictionary.

Reviewed By: bwasti

Differential Revision: D12871811

fbshipit-source-id: 486ad09f3f37723c92a946c486ce3e24a649b4e6
2018-11-01 14:27:05 -07:00
Benoit Steiner
e2e560d9c8 Improved the caffe2 to ONNX export (#13429)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13429

Made the SSA transformation idempotent. This ensures that if a caffe2 graph is already in SSA form, the name of the ONNX models inputs/outputs match these of the caffe2 graph.
Avoid evaluating the model by running it if the shapes of all the blobs are present in the value_info map. This speeds up the conversion and decrease its memory usage in the case of medium to large nets.

Reviewed By: abadams

Differential Revision: D12873354

fbshipit-source-id: d695b28e610562afa9a41c2d4da05be212ccb488
2018-11-01 12:40:24 -07:00
Michael Suo
f30c74558c Revert D10861211: Convert Arguments to dictionary
Differential Revision:
D10861211

Original commit changeset: da2fcc3e3b4d

fbshipit-source-id: 7243cb340920cf0acb57420bb5de908acd02a064
2018-10-31 12:38:43 -07:00
Michael Suo
93b16b6422 Revert D10519758: [nomnigraph] Add transpose network pass
Differential Revision:
D10519758

Original commit changeset: a268374fb0b1

fbshipit-source-id: 4de4c99a185c4083665226af94312b38dd0f6820
2018-10-31 12:34:14 -07:00
Nim Arora
cda44ffa81 Add transpose network pass (#13396)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13396

stub for bootcamp task

Reviewed By: bwasti

Differential Revision: D10519758

fbshipit-source-id: a268374fb0b119c5d1960a4382e51c5e1ca240ba
2018-10-31 11:16:41 -07:00
Nim Arora
04e8a6d9ef Convert Arguments to dictionary (#13332)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13332

Add a utility function to convert a list of caffe2_pb2.Argument to a dictionary.

Reviewed By: bwasti

Differential Revision: D10861211

fbshipit-source-id: da2fcc3e3b4dbf8decbe14a8e2d5621b3fcc377f
2018-10-31 11:16:39 -07:00
Nim Arora
2cebcbae8c createUniqueDataNode
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13395

Reviewed By: bwasti

Differential Revision: D12831584

fbshipit-source-id: a349dfe7a1da0d90e62b47e1b917f358275007be
2018-10-31 11:16:38 -07:00
Will Feng
4c06f1f2bb CircleCI: enable all flaky tests (#13356)
Summary:
A few Caffe2 tests are currently disabled in `py2-gcc4.8-ubuntu14.04` test job because they are known to be flaky. https://github.com/pytorch/pytorch/pull/13055 likely had fixed the flakiness, and this PR tests it.

Fixes https://github.com/pytorch/pytorch/issues/12395.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13356

Differential Revision: D12858206

Pulled By: yf225

fbshipit-source-id: 491c9c4a5c48ac1b791fdc9d78acf66091e80457
2018-10-31 09:34:49 -07:00
Xiaomeng Yang
bfe7df2211 Optimize rowwise_moments by MKL (#13329)
Summary:
i-am-not-moving-c2-to-c10

Pull Request resolved: https://github.com/pytorch/pytorch/pull/13329

Optimize rowwise_moments by MKL

Reviewed By: houseroad

Differential Revision: D12845220

fbshipit-source-id: b047e52ba82ed184bd322680fbf96306dfbb9867
2018-10-30 21:43:36 -07:00
Jerry Zhang
13b9fd3e05 Renaming meta() to dtype() - 2/2 (#13334)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13334

Codemod generated with clangr shard mode, 50 files per diff,
clangr code(meta->dtype): diffusion/FBS/browse/master/fbcode/caffe2/caffe2/fb/codemods/TensorMethodRename.cpp

i-am-not-moving-c2-to-c10

Reviewed By: ezyang

Differential Revision: D12845197

fbshipit-source-id: f87eb575d3c31593ca76b70780cc4fca888e706b
2018-10-30 18:24:30 -07:00
Michael Antonov
f58e4fbc45 Remove redundant array-gen loop in gather_ops_test.py (#13338)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13338

Remove unnecessary [r for r in []] statements.

Reviewed By: ezyang

Differential Revision: D12848907

fbshipit-source-id: 256551b286ac6801585acf9bb0b2644ef0b7ed58
2018-10-30 16:20:22 -07:00
Jerry Zhang
ce469e6c71 dims() to sizes() remaining part
Summary: Made the clangr rule more robust and it discovered more callsites.

Reviewed By: smessmer

Differential Revision: D12825017

fbshipit-source-id: 3be1eeb7ea697b36ef89e78ba64c0ee1259439c4
2018-10-30 14:56:21 -07:00
Dong Shi
3a81984bde Make Stat put ops accept empty tensors safely (#13178)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13178

Add default value option to stats put ops

Reviewed By: mlappelbaum

Differential Revision: D10858564

fbshipit-source-id: cc9b3e621abf3fc21821b73f354bebdcd35e477e
2018-10-30 13:28:58 -07:00
Jerry Zhang
91e87c0395 Renaming size() to numel() - 2/2
Summary:
Codemod generated with clangr shard mode, 50 files per diff,
clangr code(size->numel): diffusion/FBS/browse/master/fbcode/caffe2/caffe2/fb/codemods/TensorMethodRename.cpp

i-am-not-moving-c2-to-c10

Reviewed By: ezyang

Differential Revision: D12833748

fbshipit-source-id: 98dc2d3abc23c177c2c9e457b81499952d4b690c
2018-10-29 18:59:29 -07:00
Dong Shi
2e19529bd1 Add HasDeviceOption [nomnigraph] (#13206)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13206

Add has device option for checking if a node has a device option set

Reviewed By: bwasti

Differential Revision: D12815365

fbshipit-source-id: 58477df93777f470cfb30cd75f02a659a7017b7c
2018-10-29 14:25:40 -07:00
Bram Wasti
48b98d2f7f Expose nn:: namespace to python (#13132)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13132

Expose more of the C++ API to python

Reviewed By: duc0

Differential Revision: D10855086

fbshipit-source-id: 98cc89bc72ef91ed1c59c1a19688e047765cf90b
2018-10-29 11:36:51 -07:00
Gu, Jinghui
dbab9b73b6 seperate mkl, mklml, and mkldnn (#12170)
Summary:
1. Remove avx2 support in mkldnn
2. Seperate mkl, mklml, and mkldnn
3. Fix convfusion test case
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12170

Reviewed By: yinghai

Differential Revision: D10207126

Pulled By: orionr

fbshipit-source-id: 1e62eb47943f426a89d57e2d2606439f2b04fd51
2018-10-29 10:52:55 -07:00
Ilia Cherniavskii
1032cf9fe4 Support for zero-length sequences in RNN executor (#13244)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13244

Adding support for zero-length sequences into RNN executor

Reviewed By: dzhulgakov

Differential Revision: D10848803

fbshipit-source-id: f2994ee28c09fb30146243bb300ae7205024dd17
2018-10-29 10:32:42 -07:00
Summer Deng
723f40d94e video model test workflow on CPU (#13203)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13203

Minor changes in the test workflow to run the model on CPUs

Reviewed By: stephenyan1231

Differential Revision: D9925797

fbshipit-source-id: b7b1fb2658ab68b1ffc2b1f7b314958ea4732b32
2018-10-26 20:48:18 -07:00
Benoit Steiner
63ce3fbde8 Created a transformer to convertr caffe2 NetDef into ONNX models.
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13167

Reviewed By: abadams

Differential Revision: D11296189

fbshipit-source-id: 7e49c7a78d26f4af39d50b40f70372272debb34a
2018-10-26 15:57:53 -07:00
Junjie Bai
883da952be Hipify caffe2/core (#13148)
Summary:
petrex ashishfarmer iotamudelta
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13148

Reviewed By: xw285cornell

Differential Revision: D10862276

Pulled By: bddppq

fbshipit-source-id: 1754834ec50f7dd2f752780e20b2a9cf19d03fc4
2018-10-26 15:27:32 -07:00
zrphercule
5cbb33f939 Disable upsample optest (#13135)
Summary:
Temporarily disable upsample tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13135

Reviewed By: bddppq

Differential Revision: D10859926

Pulled By: houseroad

fbshipit-source-id: 9eb068198d43ba0939d81a9e41eb6f24ff19cb6d
2018-10-25 20:37:09 -07:00
Frank Jiang
b827a40880 Implement bucket-based attention pooling for IdScoreList features (#13004)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13004

Implement BucketWeighted model layer, which learns a weight for each possible score in an IdScoreList. Here, we assume that the scores in the IdScoreList have already been converted into the appropriate 'buckets'. If this is not done, then essentially each score represents its own bucket.

We assume that the scores/buckets are integers, and if max_score is not set, we assume that the maximum cardinality of the score is less than or equal to the cardinality of the ids.

Reviewed By: chonglinsun

Differential Revision: D10413186

fbshipit-source-id: 743e643a1b36adf124502a8b6b29976158cdb130
2018-10-25 18:04:08 -07:00
zrphercule
c6defa0847 Add randn in onnx symbolic (#12880)
Summary:
In this pr we added operator randn in onnx symbolic. Also, related tests are added.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12880

Reviewed By: houseroad

Differential Revision: D10501788

Pulled By: zrphercule

fbshipit-source-id: ba8bb00ca848c4b95decabf638a1bc13fe11d03e
2018-10-25 14:11:23 -07:00
Jerry Zhang
314d95a5f2 Renaming dims() to sizes() (caffe2/caffe2) - 3/4 (#13096)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13096

Codemod generated with clangr shard mode, 25 files per diff, for renaming dims() to sizes()

Reviewed By: ezyang

Differential Revision: D10842875

fbshipit-source-id: 1784859735ed4d1bd5ccd7ca56e289498374a68f
2018-10-25 12:14:21 -07:00
Tristan Rice
ab40eff5dd caffe2: UpsampleBilinear CUDA implementation (#12843)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12843

This adds a cuda implementation for the UpsampleBilinearOp and UpsampleBilinearGradientOp.

The CUDA code is based off of the corresponding ResizeNearest operators but with bilinear interpolation logic taken from the CPU implementation.

Reviewed By: houseroad

Differential Revision: D10453776

fbshipit-source-id: b29ac330b72465974ddb27c0587bca590773fdec
2018-10-25 11:10:04 -07:00
Bram Wasti
f1e4304d19 Add operator_def property to annotation (#13094)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13094

Expose operator_def property

Reviewed By: duc0

Differential Revision: D10847125

fbshipit-source-id: 67a066555b690715e1f5f04125fd446ab197f45a
2018-10-24 23:42:35 -07:00
Junjie Bai
e290a9d2fd Back out "Migrate DeviceOption.numa_node_id to DeviceOption.device_id"
Summary: Original commit changeset: 82583d0ad4b8

Reviewed By: enosair, ilia-cher

Differential Revision: D10560741

fbshipit-source-id: e289a37d441bd2243b369810abf451292891d9ee
2018-10-24 17:11:25 -07:00
Junjie Bai
ccfaf46431 Make CUDNN an alias of MIOPEN for HIP ops (#12278)
Summary:
This is mostly for reusing all the cudnn test cases in our python operator_tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12278

Differential Revision: D10842592

Pulled By: bddppq

fbshipit-source-id: 4b3ed91fca64ff02060837b3270393bc2f9a9898
2018-10-24 17:07:31 -07:00
Jerry Zhang
b790fcaf39 Renaming dims() to sizes() (caffe2/caffe2) - 4/4
Summary: Codemod generated with clangr shard mode, 25 files per diff, for renaming dims() to sizes()

Reviewed By: ezyang

Differential Revision: D10842900

fbshipit-source-id: 8d58ed4d403fb0308a8fa286659f8e830b040bec
2018-10-24 16:32:51 -07:00
Edward Yang
a4475d529d Use GetFetchStackTrace for the AT_* error macros too. (#13007)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13007

No reason to use the hook if it's set, this helps fbcode traces.

This slightly pessimizes the stack trace for ATen functions,
because we are no longer skipping all of the frames we should.
This is probably OK.

Reviewed By: Yangqing

Differential Revision: D10518499

fbshipit-source-id: be54e490df3c3fde7ff894b5b1473442ffc7ded3
2018-10-24 16:18:25 -07:00
Edward Yang
df47bbe9c1 Fix test_glu_old HealthCheck with smarter generation strategy. (#12975)
Summary:
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12975

Differential Revision: D10513493

Pulled By: ezyang

fbshipit-source-id: ac183aeb4ae7f0a5f91f1a369b595ae92c3e844d
2018-10-24 13:45:19 -07:00
Bram Wasti
53ac4de79d Expose basic transformation API to Python (#13033)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13033

Basic graph manipulation exposed to python

Reviewed By: ZolotukhinM

Differential Revision: D10519720

fbshipit-source-id: 0f9a494d122289a3a9e23d4cff99ac0a21382ec6
2018-10-23 20:54:54 -07:00
Yangqing Jia
ff508c91a1 Remove numba dependency
Summary:
TSIA - we want to deprecate numba in fbcode when moving to new compiler tiers.

Converted the old test to a non-numba regular python op test.

Reviewed By: xw285cornell

Differential Revision: D10519910

fbshipit-source-id: 0e9188a6d0fc159100f0db704b106fbfde3c5833
2018-10-23 17:03:47 -07:00
Michael Antonov
a6949abb15 Guard all Caffe2 protobuf string serializations with CAFFE_ENFORCE (fixed reverted bug) (#12848)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12848

Updated all non-test uses of protobuf::MessageLite::SerializeAsString to call
SerializeAsString_EnforceCheck so that the return value is checked and can
throw an exception if failing.

Most of the affected code was called from classes derived from  BlobSerializeBase.
Didn't touch most tests and ENFORCE calls because they usually do checks
anyway.

Original commit changeset: c0760e73ecc7

Reviewed By: dzhulgakov

Differential Revision: D10453456

fbshipit-source-id: d2f2b7b4578e721924354149f08f627c7e3bf070
2018-10-23 16:21:26 -07:00
Parth Raichura
8d7607e346 Add attribute exhaustive_search in _blacklist_caffe2_args (#12805)
Summary:
- exhaustive_search attribute will be blacklisted so it
     will be discarded from the coverted onnx model. At present
     it throws error while verifying the onnx model

Signed-off-by: Parth Raichura <parth.raichura@softnautics.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12805

Differential Revision: D10502374

Pulled By: ezyang

fbshipit-source-id: 0926dfa3237a8a431184e7f7250146e5b0cbfb85
2018-10-22 22:48:31 -07:00
Yinghai Lu
283d41885d Accept external input hint when doing ONNXIFI transform (#12900)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12900

Workspace sometimes will be populated with input tensors for shape inference but net.external_input() is not a reliable way to tell weights from input in the workspace. We say in some usecases where net.external_input() is empty. In this case, we need to give user an option to provide input hint.

Reviewed By: bddppq

Differential Revision: D10476822

fbshipit-source-id: 1a3fa2df69b959d5b952a7824eba9e6c713f4f07
2018-10-22 13:32:33 -07:00
Yangqing Jia
da73d709a8 Remove unsafecoalesce op (#12897)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12897

UnsafeCoalesce Op is used during memonger days when we try to coalesce operators
for better efficienct computation kernels. It creates a little bit of an unsafe
underlying memory storage pattern.

With the new tensor unification I am not sure if it is still safe for us to do
so, so I propose we delete it for the sake of safety.

Reviewed By: bddppq, ilia-cher

Differential Revision: D10475980

fbshipit-source-id: b1a838c9f47d681c309ee8e2f961b432236e157e
2018-10-22 09:42:26 -07:00
Yinghai Lu
a839a67aad Add IDEEP unit test with zero-dim tensors (#8459)
Summary:
This test flushes out the issue that IDEEP cannot handle tensor with dims like (0, 2), which is a valid tensor shape.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/8459

Differential Revision: D10419328

Pulled By: yinghai

fbshipit-source-id: c5efcd152364a544180a8305c47a2a2d126ab070
2018-10-19 23:57:33 -07:00
Dong Shi
8cb0848bdc expose delete_node (#12840)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12840

Add binding for delete_node

Reviewed By: duc0

Differential Revision: D10453555

fbshipit-source-id: cdcaca8420a9a0c61479961d907ef6bb5478a41d
2018-10-19 13:30:50 -07:00
Junjie Bai
202893fe1a Migrate DeviceOption.numa_node_id to DeviceOption.device_id
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12717

Reviewed By: ilia-cher

Differential Revision: D10408325

fbshipit-source-id: 82583d0ad4b8db094ee4c5c607b52500826328f7
2018-10-19 12:45:48 -07:00
Tristan Rice
6190408e24 caffe2: UpsampleBilinear support for scales (#12736)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12736

This updates UpsampleBilinearOp and UpsampleBilinearGradientOp to support scales to bring it inline with ResizeNearestOp https://github.com/pytorch/pytorch/pull/12720.

Reviewed By: houseroad

Differential Revision: D10416228

fbshipit-source-id: f339b7e06979c9c566afb4cee64a2d939b352957
2018-10-19 08:55:55 -07:00
Lu Fang
f9d1b63d18 Automatic update of fbcode/onnx to f8828e532da4795e8ea15f5850a37c5179917b9b (#12823)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12823

Previous import was 1cbe2743cda739ff752d6ce79553b0ef8ad49783

Included changes:
- **[f8828e5](https://github.com/onnx/onnx/commit/f8828e5)**: Use vector instead of set to keep the order of the opt passes (#1524) <Lu Fang>
- **[b5a37c4](https://github.com/onnx/onnx/commit/b5a37c4)**: Pin awscli to last known good version (#1518) <bddppq>
- **[3e219f6](https://github.com/onnx/onnx/commit/3e219f6)**: ONNX Optimization Rewrite (#1452) <Armen>
- **[96758c9](https://github.com/onnx/onnx/commit/96758c9)**: Add MaxUnpool op to ONNX. (#1494) <Spandan Tiwari>
- **[c4f7043](https://github.com/onnx/onnx/commit/c4f7043)**: Update docker image version used in CircleCI (#1511) <bddppq>

Differential Revision: D10447573

fbshipit-source-id: 8748ba6e3be322a26a9a360ff7f2babd54fd581f
2018-10-18 16:17:25 -07:00
Dmytro Dzhulgakov
92890d4314 Delete ExtendTensor operator
Summary: Added 2 years ago in D3665603, never used, kill it.

Reviewed By: ezyang

Differential Revision: D10421336

fbshipit-source-id: 1b027a9ef2b71d0dd2c572cd4338bc8e046320d8
2018-10-18 15:18:40 -07:00
Yinghai Lu
ed317b6203 Remove useless MKL target (#12783)
Summary:
Context: https://github.com/pytorch/pytorch/pull/12625#issuecomment-430560919
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12783

Differential Revision: D10451726

Pulled By: yinghai

fbshipit-source-id: 3cd1e61209628d7c52b440e5b232ae95dd09885e
2018-10-18 14:03:34 -07:00
Junjie Bai
805f4d5cb8 Revert D10416438: Guard all Caffe2 protobuf string serializations with CAFFE_ENFORCE
Differential Revision:
D10416438

Original commit changeset: cb842e3e26b0

fbshipit-source-id: c0760e73ecc76ca9b1b74f6844e243c2df5260a2
2018-10-18 13:46:33 -07:00
Bram Wasti
dec9bc5f0b Expose device_option directly
Summary: as title states

Reviewed By: duc0

Differential Revision: D10442424

fbshipit-source-id: bba2dd600e1979ff018ac0e403463f992a94a6e5
2018-10-18 13:22:17 -07:00
Michael Antonov
63cd051867 Guard all Caffe2 protobuf string serializations with CAFFE_ENFORCE (#12799)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12799

Updated all non-test uses of protobuf::MessageLite::SerializeAsString to call
SerializeAsString_EnforceCheck so that the return value is checked and can
throw an exception if failing.

Most of the affected code was called from classes derived from  BlobSerializeBase.
Didn't touch most tests and ENFORCE calls because they usually do checks
anyway.

Reviewed By: ezyang

Differential Revision: D10416438

fbshipit-source-id: cb842e3e26b0918829d71267a375d4dd40600d58
2018-10-18 12:49:01 -07:00
Duc Ngo
2c566a17c7 nomnigraph - simplify subgraph matching APIs (#12681)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12681

- Get rid of NodeMatchCriteria as a template parameter, which was too generic. So MatchNode<NodeMatchCriteria> becomes MatchNode<GraphType>, and MatchStore stores the predicate on GraphType::NodeRef.

- Similarly, get rid of NNNodeMatchCriteria

Now one can just pass in a function pointer NodeRef -> bool to NNMatchNode constructor directly like this

mg.createNode(is<Relu>)

- Merge static utilities in SubgraphMatcher class into MatchGraph class

- Rename MatchNode to MatchPredicate

Change use cases and tests to make it work

Reviewed By: ZolotukhinM

Differential Revision: D10386907

fbshipit-source-id: 43874bd154e3d7c29ce07b4b74eca8a7a9f3078a
2018-10-18 12:32:40 -07:00
Tommy Yu
2b63b7a0a5 Support GPU version of Spatial Batch Norm (#11711)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11711

Added GPU support for spatial batch normalization. This functions by reducing values from GPUs onto a CPU and broadcasting those results back to each GPU. We have run several experiments, and found these results to be better than those without spatial bn: https://fb.quip.com/fr7HAeDliPB8

Reviewed By: enosair

Differential Revision: D9547420

fbshipit-source-id: ccbd2937efd6cfd61182fff2f098fb7c5ae8aeb1
2018-10-18 11:22:13 -07:00
Lu Fang
f1e7d384b6 Support scales as inputs in ResizeNearest (#12720)
Summary:
To address https://github.com/onnx/onnx/pull/1467
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12720

Reviewed By: BIT-silence

Differential Revision: D10414813

Pulled By: houseroad

fbshipit-source-id: 8831381b0115c363065c8d23bd1a95b4d641b857
2018-10-17 23:08:53 -07:00
Bram Wasti
84edd4a48b Enable mapping from operatordef to converted node for debugging
Summary: Add a mapping for conversion -- this will help with debugging as well but is directly used by the TUI stacked on top of this

Reviewed By: duc0

Differential Revision: D10396130

fbshipit-source-id: cdd39278f0ed563bb828b1aebbbd228f486d89c8
2018-10-16 21:03:28 -07:00
Lu Fang
30aaa07594 New serialization format (#12384)
Summary:
Addressed Dima's feedback.

The proposal is here: https://fb.quip.com/TbQmAuqIznCf
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12384

Reviewed By: dzhulgakov

Differential Revision: D10246743

Pulled By: houseroad

fbshipit-source-id: c80db0c35d60ca32965275da705f2b1dfb2a7265
2018-10-16 16:36:58 -07:00
Yinghai Lu
4d698cae2e Enhance shape inference in ONNXIFI transformer (#12685)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12685

In this diff, we push the fake run of the net into the ONNXIFI transformer, because
1. We cannot do shape inference for every op
2. Since the net has been SSA rewritten, we cannot use shape info from outer workspace directly.

In addition, this diff adds input shape info when querying the `onnxBackendCompatibility` function.

Reviewed By: bddppq

Differential Revision: D10390164

fbshipit-source-id: 80475444da2170c814678ed0ed3298e28a1fba92
2018-10-16 14:15:46 -07:00
Bram Wasti
31d8e5e71a Improve Python API with the addition of pythonic setters/getters
Summary:
Simple additions that make it vastly easier to use nomnigraph in
python

Reviewed By: duc0

Differential Revision: D10383027

fbshipit-source-id: 441a883b84d4c53cca4f9c6fcc70e58692b8f782
2018-10-16 00:57:54 -07:00
Yangqing Jia
083e037dea minor fix (#12688)
Summary:
This seems to be a typo that never got caught - no actual functionality changes.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12688

Differential Revision: D10391704

Pulled By: Yangqing

fbshipit-source-id: ce633776957628c4881956c5423bfab78294d512
2018-10-15 17:25:49 -07:00
Viswanath Sivakumar
ade97afc74 Re-enable IDEEP graph rewrite test (#12661)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12661

Was disabled since workspace.has_mkldnn is now set to false

Reviewed By: yinghai

Differential Revision: D10383913

fbshipit-source-id: ad6dc705f0606b3711e8b450dc384ad3ebb87686
2018-10-15 15:50:28 -07:00
Evan Klitzke
189c1e1afb Rewrite http://pytorch.org -> https://pytorch.org throughout project (#12636)
Summary:
The pytorch.org site redirects all of the http:// requests to the https:// site anyway, so the comments and error messages might as well refer directly to the https:// site. The GitHub project description should also be updated to point to https://pytorch.org
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12636

Differential Revision: D10377099

Pulled By: soumith

fbshipit-source-id: f47eaba1dd3eecc5dbe62afaf7022573dc3fd039
2018-10-15 13:03:27 -07:00
Bram Wasti
a6c7cf8741 python bindings: enable generic nn operator handling
Summary: hotfix to unblock @[100000295380748:Dong Shi]

Reviewed By: duc0

Differential Revision: D10385763

fbshipit-source-id: 80badd31c1039a245f32940c719e867a86ec7e47
2018-10-15 12:55:42 -07:00
Andrey Malevich
eaf33f22c8 Revert D10123465: Set the correct engine name for position weighted pooling when fp16 is used for training
Differential Revision:
D10123465

Original commit changeset: e8d929d4153d

fbshipit-source-id: 36269e49ac79955fe695ac1a53a3c386aa2f5bec
2018-10-15 01:53:48 -07:00
Edward Yang
0c6ab0e8f4 Delete caffe2/mkl, and references. (#12625)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12625

It's obsoleted by ideep

Reviewed By: Yangqing

Differential Revision: D10372230

fbshipit-source-id: 2d6475ae72389dd654ba0bcbb57766530eb4ac1a
2018-10-13 22:02:32 -07:00
Jiyan Yang
635cbff300 Set the correct engine name for position weighted pooling when fp16 is used for training
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12225

Reviewed By: hyuen, xianjiec

Differential Revision: D10123465

fbshipit-source-id: e8d929d4153d1ee987ae3d1c37892525d7574d16
2018-10-12 20:15:13 -07:00
Hector Yuen
17ab3bd502 implement rowwise quantization for fp16 (#12382)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12382

implement fp16-> (uint8 + scale and bias in fp32)

this is similar to fp32 rowwise quantization

we could have done scale and bias in fp16 but not too motivated since we are not saving much and those datatypes have to be converted to fp32 to process since x86 doesn't support half float operations anyways

Reviewed By: csummersea

Differential Revision: D10220463

fbshipit-source-id: 6c382026de881f03798c2e5fc43abfc80f84ea1f
2018-10-12 13:57:55 -07:00
103yiran
239b2ac718 make the variable declaration closer to usage
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/9262

Differential Revision: D10363576

Pulled By: ezyang

fbshipit-source-id: 05c8eb12f3b389caf562cca9e338cc91b0e9acc1
2018-10-12 12:07:08 -07:00
Aidan Cully
12686ec656 fix _AllReduce not applying the DeviceScope guard to model.Copy operations. (#12342)
Summary:
This resolves an issue where the `model.Copy` operation would
copy to the wrong GPU, such that the below `net.Sum` operation
would use an input argument for which p2p access was not enabled.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12342

Differential Revision: D10343181

Pulled By: ezyang

fbshipit-source-id: fd2d6d0ec6c09cda2db0a9a4f8086b3560e5a3ec
2018-10-12 10:47:58 -07:00
Xiaolong Wang
93a4b76114 Enable alternative LayerNorm impl in FisherGan (#12178)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12178

Fisher GAN calls processor_util.add_mlp, which inject the layer norm through the
normalizer. We allow to use alternative impl for LayerNorn in the normalizer.

Reviewed By: Wakeupbuddy

Differential Revision: D9235528

fbshipit-source-id: 88c126c658102926613242ef84a481f6de1676ed
2018-10-11 17:36:11 -07:00
Xiaolong Wang
8ac8b823c2 Allow use substitute ops for LayerNorm (#12177)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12177

as titled

Reviewed By: Wakeupbuddy

Differential Revision: D9218047

fbshipit-source-id: 8d68861472c99d587e678c3d76ac43abc9c8fe6d
2018-10-11 17:36:10 -07:00
wuhuikx
033e00cd3f Fix bug in caffe_translator tool (#10056)
Summary:
1. Fix BN translator
    IntelCaffe and NVCaffe fuse BN+Scale, and the "BatchNorm" op contains 5 params including (scale and bias)

2. Fix Scale translator
   the translated outputs of scale have the same names with those of Conv.
   All their names are output + '_w' and output + '_b'
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10056

Differential Revision: D10099205

Pulled By: yinghai

fbshipit-source-id: 73a73868e3e16c495e8b233fdb1d373d556a9537
2018-10-11 13:13:12 -07:00
Wei Wen
666bebc7d2 adapting caffe2 operator docs generator to pytorch url
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/10801

Differential Revision: D9472991

Pulled By: ezyang

fbshipit-source-id: 1b8ba77b8255b7e900b6528bd93b3b870f9ba0d4
2018-10-11 12:55:06 -07:00
Jerry Zhang
b89a3b50fb Remove StaticContext (#12547)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12547

Pull Request resolved: https://github.com/pytorch/pytorch/pull/12305

Remove StaticContext from context_base.h

Reviewed By: dzhulgakov

Differential Revision: D10073519

fbshipit-source-id: 350beec3c54365edef338318ce58229ccb825a98
2018-10-10 19:41:03 -07:00
Dong Shi
da3dd9af12 No Op Optimizer (#12390)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12390

Introduce a no op optimizer for when we don't want updates to happen, but don't want to affect downstream processes.

Reviewed By: mlappelbaum

Differential Revision: D10209812

fbshipit-source-id: 2af4ebc0fb42e78ea851c3a9f4860f3d224037b6
2018-10-10 18:09:46 -07:00
Junjie Bai
f54ab540af Rename cuda_gpu_id to device_id in DeviceOption (#12456)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12456

codemod with 'Yes to all'
codemod -d . --extensions h,cc,cpp,cu,py,proto,pbtxt,pb.txt,config cuda_gpu_id device_id

Overload TextFormat::ParseFromString to do string replace when parsing from protobuf format

Reviewed By: Yangqing

Differential Revision: D10240535

fbshipit-source-id: 5e6992bec961214be8dbe26f16f5794154a22b25
2018-10-09 15:54:04 -07:00
Will Feng
cdead5ace1 Enable CircleCI for Linux jobs (#12389)
Summary:
Changes in this PR:
1. Intermediate Docker image is shared from build stage to test stage through ECR, in order to fix the Caffe2 flaky CUDA tests.
2. There are ~7 Caffe2 operator tests that are only flaky in `caffe2_py2_gcc4_8_ubuntu14_04_test` on CPU. Disabling those tests on that config only, which is okay to do because we are still running those tests in other test jobs.

After this PR is merged, CircleCI will be running on master automatically, and will be running on PRs if the author rebased their PR onto the newest master (which we will ask all the authors to do when we switch off Jenkins for Linux).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12389

Differential Revision: D10224267

Pulled By: yf225

fbshipit-source-id: dd1a90a425c3d13b870d3d328cb301eee2e6e2cd
2018-10-08 17:09:37 -07:00
Dong Shi
5a0d2c7138 Add clamping functionality to stats_put_ops
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12391

Reviewed By: mlappelbaum

Differential Revision: D10220000

fbshipit-source-id: 10fdbc8ebab931a5be31df964b5de5728048205d
2018-10-08 16:53:26 -07:00
Bram Wasti
7103d0d938 Add python bindings (#12253)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12253

Adding python bindings to unblock DAI development

Reviewed By: duc0

Differential Revision: D10141621

fbshipit-source-id: efac7fb8a0cc787e1c4cc94515e673812529a997
2018-10-08 12:24:53 -07:00
Edward Yang
54d9823d00 Make caffe2::Tensor::dims() return an IntList instead of a const vector& (#12180)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12180

I had to fix a lot of call sites, because a lot of places assume that
you can actually get a const vector&, and if the internal representation
of sizes in a tensor is NOT a vector, it's not possible to fulfill
this API contract.

Framework changes:
- I deleted TensorImpl::dims(); caffe2::Tensor::dims() just forwards to
  sizes() now.
- De-templatized SetDims; now it is an explicit list of ArrayRef and
  variadic overloads.  This makes implicit conversions work again,
  so I don't need to explicitly list the std::vector cases too.
  - As a knock-on effect, this causes Reset() to accept at::IntList as well as
    const std::vector<int64_t>&
- Edited variadic overloads of SetDims to all forward to the underlying
  arbitrary-dim implementation, reducing code duplication. (It's probably
  marginally less efficient in the new world.)
- Replace Tensor constructor accepting const std::vector<int64_t>& with at::IntList
- Make MKLTensor accept ArrayRef along with vector in constructor and
  Reset (unfortunately, no implicit conversions here, since it's templated on
  index type.)
- There are a few other places, like cudnn, where I changed functions
  that previously took const std::vector<int64_t>& to take at::IntList
  instead.

Classification of call site changes:
- 'const std::vector<int64_t>& x_dims = x.dims()' ==>
  'at::IntList x_dims = x.dims()'
- 'std::vector<int64_t> x_dims = x.dims()' ==>
  'std::vector<int64_t> x_dims = x.dims().vec()' (we need a copy!)
  Usually this is because we're about to mutably modify the vector
  to compute some new dimension.  However, it also very commonly occurs in the
  form: 'x_dims_ = x.dims()' because we frequently cache sizes in operators.
- Instead of constructing std::vector<int64_t>{blah, blah}, construct an
  at::IntList directly

ArrayRef changes:
- cbegin()/cend() iterators, they operate the same aas begin()/end() because
  everything on ArrayRef is const.
- Moved operator<< into ArrayRef.h, so that it's always available when
  working with ArrayRef.  I also templated it, so it now works on an
  ArrayRef of any type.
- Add operator== overload for ArrayRef, and also add variants to permit
  comparison of ArrayRef with std::vector, a very common operation.
  (The non-templated version of operator== can get these automatically
  via implicit conversion, but with templates C++ refuses to do
  any explicit conversions.)

I'm planning to audit all dims() call sites to make sure they don't
expect 'auto x = t.dims()' to give you an x whose lifetime can validly
outlive the tensor.

I opted not to do a dims() to sizes() rename, because dims() also matches
the protobufs accessor.  Bad news!

Reviewed By: jerryzh168

Differential Revision: D10111759

fbshipit-source-id: a2a81dc4b92c22ad4b3b8ef4077a7e97b6479452
2018-10-05 15:57:41 -07:00
vishwakftw
39bd73ae51 Guard NumPy usage using USE_NUMPY (#11798)
Summary:
All usages of the `ndarray` construct have now been guarded with `USE_NUMPY`. This eliminates the requirement of NumPy while building PyTorch from source.

Fixes #11757

Reviewed By: Yangqing

Differential Revision: D10031862

Pulled By: SsnL

fbshipit-source-id: 32d84fd770a7714d544e2ca1895a3d7c75b3d712
2018-10-04 12:11:02 -07:00
Yangqing Jia
38f3d1fc40 move flags to c10 (#12144)
Summary:
still influx.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12144

Reviewed By: smessmer

Differential Revision: D10140176

Pulled By: Yangqing

fbshipit-source-id: 1a313abed022039333e3925d19f8b3ef2d95306c
2018-10-04 02:09:56 -07:00
Wanchao Liang
8aa23907e8 Make if block also take control_inputs, preserve SSA (#12224)
Summary:
If block is missing control inputs when do caffe2 net execution, this PR add them back and remove the un-SSA semantics

jamesr66a
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12224

Differential Revision: D10135408

Pulled By: wanchaol

fbshipit-source-id: 746c870bde54ed4ca627167361db1b3f36cd235c
2018-10-03 14:29:01 -07:00
Junjie Bai
035d04299c Update onnx to onnx/onnx@ddf8eb6 (#12267)
Summary:
ddf8eb6aa0
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12267

Reviewed By: yinghai

Differential Revision: D10151536

Pulled By: bddppq

fbshipit-source-id: 4cb04fcc0377c6c39fb318c5fc7043e67c400866
2018-10-02 15:57:43 -07:00
Dmytro Dzhulgakov
1d3f650ce4 Revert D10098106: [pytorch][PR] [WIP] New version of PT1 model format
Differential Revision:
D10098106

Original commit changeset: 94ec7fc57c84

fbshipit-source-id: 38f729b0970618f38359797b806cbbcd865f4715
2018-10-02 00:43:40 -07:00
Junjie Bai
ff608a9ff3 Back out "Revert D10123245: Back out "codemod cuda_gpu_id to device_id"" (#12232)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12232

Original commit changeset: fca91fea58b7

This adds proper modifications to the DeviceType <->DeviceOption conversion code added in D10033396

Reviewed By: jerryzh168

Differential Revision: D10132473

fbshipit-source-id: 801ef777e2950982cb47b48051b1471a0a91e64b
2018-10-01 21:54:52 -07:00
Shicong Zhao
ecace9eb21 Move crf in caffe2 from fb to oss (#12200)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12200

moved crf_viterbi_op, copied crf_predict and crf_viterbi_test to oss

Reviewed By: Yangqing

Differential Revision: D10118341

fbshipit-source-id: 51e30e57d280d6ca75fc0b488f743794f23b589f
2018-10-01 18:31:41 -07:00
Junjie Bai
26df16eb21 Clear previous device option when keep_device is set in load op
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12240

Reviewed By: jerryzh168

Differential Revision: D10133933

fbshipit-source-id: 05935bd527177f936c1d08626888d43dedbf5ce4
2018-10-01 17:20:26 -07:00
Lu Fang
35becd1879 New version of PT1 model format (#12149)
Summary:
Considered four different existing formats: 1) static graph, 2) torch script, 3) pickle files, 4) PyTorch C++ serialize APIs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12149

Reviewed By: BIT-silence

Differential Revision: D10098106

Pulled By: houseroad

fbshipit-source-id: 94ec7fc57c842e50fae5286ddeda657a4967a07a
2018-10-01 15:57:02 -07:00
Rick Ratmansky
3010dc4208 Revert D10123245: Back out "codemod cuda_gpu_id to device_id"
Differential Revision:
D10123245

Original commit changeset: d83da8e00a12

fbshipit-source-id: fca91fea58b7df208edc2e218a1d514f9821ec7b
2018-10-01 12:22:36 -07:00
Yang Liu
7d7d336c45 Back out "codemod cuda_gpu_id to device_id"
Summary:
Original commit changeset: f5614a5d2607

D9986213 is causing Multifeed Aggregator a [huge performance different](https://our.intern.facebook.com/intern/ads/analyze_canary/412951953278781781/) and is blocking aggregator push since last Friday night: https://fburl.com/feedtools/b6izvwjz
We need to land this revert ASAP to unblock aggregator push.

Reviewed By: orionr

Differential Revision: D10123245

fbshipit-source-id: d83da8e00a1250f5d09811a0a587c127e377aab2
2018-10-01 11:31:14 -07:00
Duc Ngo
e43ffb0148 nomnigraph - easy - some code cleanup for transformations_test (#12101)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12101

clean up some duplicate test code

Reviewed By: ZolotukhinM

Differential Revision: D10051914

fbshipit-source-id: 698ff144a85e8c70572116c5ddb415cd2396b4e3
2018-10-01 11:31:08 -07:00
Jerry Zhang
006171fffc Back out "[pytorch][PR] Revert "Move CreateContext to global registry (#11688)"" (#12121)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12121

Pull Request resolved: https://github.com/pytorch/pytorch/pull/12055

Original commit changeset: 6ca9de65b707

Reviewed By: ezyang

Differential Revision: D10033396

fbshipit-source-id: ca9f4b2f7ef0561f619b833415d394a8b9972bf4
2018-10-01 11:10:46 -07:00
Jiyan Yang
40aa212cd6 Support fp16 mkl engine in training
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12080

Reviewed By: hyuen

Differential Revision: D10037719

fbshipit-source-id: 618ce894eccc4c87a038dc3ab836684f16843cde
2018-09-29 21:55:11 -07:00
Satish Nadathur
04c0971679 Special case BatchGather and BatchGatherGradient for block_size=1. (#11349)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11349

Special case BatchGather and BatchGatherGradient for block_size=1. This makes BatchGather 3-4X faster and BatchGatherGradient 10X for this case.

Reviewed By: jspark1105, ilia-cher

Differential Revision: D7218043

fbshipit-source-id: ea12042239a8adc92b9efcbd0b66e354fb43f4c7
2018-09-27 21:11:38 -07:00
Junjie Bai
3eb5940cf5 codemod cuda_gpu_id to device_id (#12022)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12022

codemod -d . --extensions h,cc,cpp,cu,py,proto,pbtxt,pb.txt,config cuda_gpu_id device_id

codemod with 'Yes to all'

Reviewed By: orionr

Differential Revision: D9986213

fbshipit-source-id: f5614a5d26078817aee8caf79a494abfd6a95ff1
2018-09-27 20:24:53 -07:00
Cheng,Penghui
6e7e63fda3 Implementation MomentumSGD/MomentumSGDUpdate operators for mkl-dnn (#11686)
Summary:
the speed-up of a single operation is up to 6X on BDW.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11686

Reviewed By: yinghai

Differential Revision: D9828129

Pulled By: wesolwsk

fbshipit-source-id: 7dbacea90609e18438f6fe1229c641937d0696c8
2018-09-27 13:39:59 -07:00
Yangqing Jia
9c49bb9ddf Move registry fully to c10 (#12077)
Summary:
This does 6 things:

- add c10/util/Registry.h as the unified registry util
  - cleaned up some APIs such as export condition
- fully remove aten/core/registry.h
- fully remove caffe2/core/registry.h
- remove a bogus aten/registry.h
- unifying all macros
- set up registry testing in c10

Also, an important note that we used to mark the templated Registry class as EXPORT - this should not happen, because one should almost never export a template class. This PR fixes that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12077

Reviewed By: ezyang

Differential Revision: D10050771

Pulled By: Yangqing

fbshipit-source-id: 417b249b49fed6a67956e7c6b6d22374bcee24cf
2018-09-27 03:09:54 -07:00
Dong Shi
d9c27f4d8d T33898723: Simple put operators for caffe2 stats (#12057)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12057

Add simple put operators for various types of stats

Reviewed By: mlappelbaum

Differential Revision: D9925268

fbshipit-source-id: cec02b0027d2d0ef3d35741be4b02c429d492810
2018-09-26 12:39:37 -07:00
Ansha Yu
8ff435c8f6 Use tempfile during serialized test comparison (#12021)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12021

TestPilot runs stress tests in parallel. These fail for serialized tests because extracting (and subsequent deletion) of binary data during the process isn't threadsafe. Extract zips into tempfile to avoid this problem.

Also remove some accidentally checked in zips of a test that we didn't end up including for now.

Reviewed By: houseroad

Differential Revision: D10013682

fbshipit-source-id: 6e13b850b38dee4106d3c10a9372747d17b67c5a
2018-09-25 20:55:45 -07:00