Commit Graph

78 Commits

Author SHA1 Message Date
Xuehai Pan
8d45f555d7 [BE] [1/3] Rewrite super() calls in caffe2 and benchmarks (#94587)
Rewrite Python built-in class `super()` calls. Only non-semantic changes should be applied.

- #94587
- #94588
- #94592

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

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

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

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

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

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94587
Approved by: https://github.com/ezyang
2023-02-11 18:19:48 +00:00
Bugra Akyildiz
27c7158166 Remove __future__ imports for legacy Python2 supports (#45033)
Summary:
There is a module called `2to3` which you can target for future specifically to remove these, the directory of `caffe2` has the most redundant imports:

```2to3 -f future -w caffe2```

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

Reviewed By: seemethere

Differential Revision: D23808648

Pulled By: bugra

fbshipit-source-id: 38971900f0fe43ab44a9168e57f2307580d36a38
2020-09-23 17:57:02 -07: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
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
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
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
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
Yinghai Lu
ef8f556212
[Caffe2] Changes done inside Facebook (#6378)
* fix unit test for sqrt op

From the error logging:

[idx, grad, grad_estimate] are:
[[ 146.            0.5           0.45776367]
 [ 147.            0.5           0.45776367]

The gradient == 0.5 is correct, which means the SqrtOp and its gradient is doing right job. (Because y = sqrt(x), loss = y^2/2 = x/2, and then d(loss)/dx = 1/2 = 0.5; )

The test failed because of numerical problem of grad_estimate (in unit test). It can be because the step_size is small, and float precision is not high (when there are multiple elements in the tensor, we do sum(y^2) to compute loss)

This diff
- increase the step size, and also move the test cases to be further away from 0 (where sqrt(x) is not well defined) to be safe :)
- also clean up, and merge the test case for inplace Vs. non-inplace

Tested with:

`CAFFE2_HYPOTHESIS_PROFILE=debug ai_bt caffe2/caffe2/python/operator_test:elementwise_ops_test -- "test_sqrt"`

* CompositeReader & CompositeReaderBuilder

A new type of reader gluing multiple readers together.

* Back out "Revert D7394363: [GanH]: Log D Trick for Cross Entropy with Sigmoid"

Original commit changeset: 9325a4356dbe

* [dai][WIP] convert params to int8 on ps before sending to trainer

Add float->uint8 conversion in addition to float->fp16 conversion in model_saver.

* [easy] improve unit test for sparse length sum ops

as desc.

#accept2ship

* Update GitHub upstream to 771fcb3455

* move sparse hash unique ops to OOS and add unit tests

- move the SparseHash version to OOS, since 'sparsehash' is already deps of caffe2 OOS: https://fburl.com/arssw4n1
- The 'SparseHash' engine is also being used in OOS, so the SparseHash version shall be in OOS to reduce confusion: https://fburl.com/o5ea7ah2

- fix the CUDA UniqueOp for the case when batch is empty.
- add unit test

* group_norm_op for caffe2

This is the cuda op for Group Normalization (GN): https://arxiv.org/abs/1803.08494

This code implements GN in one op that computes Y=gamma * (X-mu) / sigma + beta and also its gradients. It is expected to have minimal memory consumption (similar to the BN op), without creating new blobs if GN were implemented as several ops (e.g., reshape, norm_mean/std, affine_channel).

* Resubmit D7405233: disappeared in D7464958

OOS publish causes the op missing -- however, test was still there

* [c2] add sparse hash engine for cuda unique op

The SparseHash version of UniqueOp copy input tensor to CPU, and make use of sparse hash map to get unique output, and then copy back to GPU.

* [dper][gpu] enable unit testing gpu trainer for sparse nn

to debug the GPU trainer using mock data in unit test.

make it easier to develop GPU trainer for new models.

* Reuse Gloo context for Synchronize() calls

Previously we were creating (and leaking) the Gloo context on each call to Synchronize(). Now only run the common world op and create the barrier net once, then run the barrier net on each Synchronize() call. Since timeout is associated with the Gloo context, assert that the timeout is fixed instead of trying to handle the complexity of multiple timeouts (and associated contexts).

* [GanH/WGAN][1/n]: add FC param clipping

as titled

* [mobile] minimizing changes between caffe2_benchmark and speed_benchmark

* [GanH]: enable diagnose within model

avoid finding blob names but to directly enable inside the model

* Add `net_transformer_fun` option to DPM

This callback allows for various transformations to be made to the
model after gradient operators have been added. The immediate motivation for
this is to allow transformations such has "checkpoint-and-recompute" which
allow trading off memory for additional compute.

Adding several callbacks like this has made DPM's API less than ideal at this
stage. However, I could not find any reasonable alternative.

* [DT] [33/n] Compile flow task groups

task groups need to compiled in order to pickle the object in fblearner. However I also changed the Job's compile function as creating new object is not necessary.

* Initial commit for sparse_normalize vectorization and benchmark

* [GanH]: LB Calibration for JSD

as titled

* Tracing event in async executor

Adding event tracing through TRACE_EVENT macro in async executor

* [Resubmit] D7409751 Reseting book-keeping blobs when the reservoir is reset

D7409751 got lost in D7464958

* Visualizing realtime weights values

we want to visualize the weights values as optimizer is iterating. This diff supports to visual the weights at an assigned index.
Currently, we assume the blob to be 2 dimensional.

* [GanH][Easy]: Fix Homotopy Weighting

apparantely, there was a bug in homotopy weight (alpha, beta) update

* [c2] move sparse hash unique op out of oss

so that oss do not need to depend on google hash map.

* Get rid of std::round as it's not supported on Android

* Revert changes on setup.py

* Skip shaky test on Dataio

* fix
2018-04-10 21:11:43 -07:00
Orion Reblitz-Richardson
1d5780d42c Remove Apache headers from source.
* LICENSE file contains details, so removing from individual source files.
2018-03-27 13:10:18 -07:00
Yangqing Jia
8286ce1e3a Re-license to Apache
Summary: Closes https://github.com/caffe2/caffe2/pull/1260

Differential Revision: D5906739

Pulled By: Yangqing

fbshipit-source-id: e482ba9ba60b5337d9165f28f7ec68d4518a0902
2017-09-28 16:22:00 -07:00
Yiming Wu
1b7497807f cnnmodelhelper deprecate warning
Summary: We will start our API migration process. Before that, I want to make sure people don't add new CNNModelHelper instance to our opensource code. So that I put deprecation warning here in advance

Reviewed By: salexspb

Differential Revision: D5093556

fbshipit-source-id: 74bf4a7782c2d882f72f202d48c72255d152b68a
2017-05-18 23:35:26 -07:00
Yiming Wu
3eeca5b5e0 arg scope in ModelHelper
Summary: based on our discussion, we want an arg_map in ModelHelper and create arg_scope for that model within brew. Now it is realized

Reviewed By: salexspb

Differential Revision: D5042983

fbshipit-source-id: ddd2c7e9bca1be2f08a32f7252b44d3b60a57996
2017-05-12 11:18:59 -07:00
Simon Layton
1d0ba2cfbd New cudnn ops
Summary:
cuDNN versions of dropout and LRN (for native fp16 support), port of Caffe's max pooling algo that uses an explicit mask to store locations (also supports fp16 storage)
Closes https://github.com/caffe2/caffe2/pull/396

Reviewed By: akyrola

Differential Revision: D4990880

Pulled By: asaadaldien

fbshipit-source-id: a716acffb656843e9b31e3e6808bd2d8aa959d03
2017-05-08 16:33:21 -07:00
Du Tran
033ab9da1b Adding video data layer for caffe2
Summary: Adding a simple video data layer which allows to read video data from frames, videos and output 5D tensor. It also allows multiple labels. The current implementation is based on ffmpeg

Differential Revision: D4801798

fbshipit-source-id: 46448e9c65fb055c2d71855447383a33ade0e444
2017-05-05 14:16:38 -07:00
Yiming Wu
aa5a46b848 fix LRN order
Summary: fix LRN helper's order

Reviewed By: salexspb

Differential Revision: D4949902

fbshipit-source-id: 88b1aa985546d36aa66c0677c617979ff186d78a
2017-04-27 16:46:47 -07:00
Yiming Wu
2c8b41e3f3 Adding add_weight_decay and image_input to brew module
Summary:
Adding add_weight_decay and image_input to brew module & remove `getWeights` and `getBias` from CNNModelHelper

With fbgs `useWeights`, the results show that noone but add_weight_decay is using this function. I checked with oculus people, their getWeights is a different function.

kennyhorror Please notice whether this is going to affect you :)

Reviewed By: salexspb

Differential Revision: D4945392

fbshipit-source-id: 4ef350fd81dd40a91847e9f3ebc5421eb564df32
2017-04-25 16:03:58 -07:00
Yiming Wu
0bb558716a rename model_helpers to brew and lowercase all helper functions
Summary:
rename model_helpers to brew. This is a big diff now. I did these things:

1. replace model_helpers with brew:

  find . -type f -exec sed -i 's/model_helpers/brew/g' {} +

2. rename model_helpers.py and model_helpers_test.py
3. rename ModelHelpersTest to BrewTest
4. lowercase all the helper functions to distinguish them from single op
5. run my unittests
6. run converge tests

Reviewed By: salexspb

Differential Revision: D4930465

fbshipit-source-id: f420a1b03238df1cbe9f4426e0b9c43a12119661
2017-04-24 15:52:26 -07:00
Yiming Wu
bef6e45f8b rename ModelHelperBase
Summary:
rename ModelHelperBase to Model.

This is the result of running:

  find . -type f -exec sed -i 's/ModelHelperBase/ModelHelper/g' {} +

We had 19 results when fbgs ModelHelperBase. Here is 20 instances because I added 1 test in model_helpers_test.py

Reviewed By: salexspb

Differential Revision: D4928337

fbshipit-source-id: bc4c12b60b90c167e717de50ea9fe17521e142e3
2017-04-24 15:52:26 -07:00
Yiming Wu
c3a4468af6 Add conv helpers and proxy to CNN
Summary:
Add conv helpers, the migration of functions assumes that people should not do

  cnn_model = CNNModelHelper(use_cudnn=True)
  cnn_model.Conv(..., use_cudnn=False, ...)

Reviewed By: salexspb

Differential Revision: D4884974

fbshipit-source-id: 12af6e2a5863eba789232cd4a4771f95d05f9227
2017-04-17 15:03:05 -07:00
Yiming Wu
2043b3c114 train and algebra helpers
Summary: Adding train and algebra helpers

Reviewed By: salexspb

Differential Revision: D4884951

fbshipit-source-id: 7a18eb986a7356977a6c3d7a62a996ddce0c793e
2017-04-17 15:03:05 -07:00
Yiming Wu
277b4eca97 array helpers (concat)
Summary: Adding array helpers

Reviewed By: salexspb

Differential Revision: D4884933

fbshipit-source-id: 2ec3dd37b243c8c717e299876eef7650a08d3f2b
2017-04-17 15:03:04 -07:00
Yiming Wu
ed3f0ac5e9 nonlinearity helpers
Summary: adding nonlinearity helpers

Reviewed By: salexspb

Differential Revision: D4884894

fbshipit-source-id: fe180df23daabb62175d5a6ae7b46ccb5f7d0123
2017-04-17 15:03:04 -07:00
Yiming Wu
3623c241c4 normalization helpers
Summary: Add normalization helpers

Reviewed By: salexspb

Differential Revision: D4884786

fbshipit-source-id: 529e678bae133e85d981310014c15d551d39d48b
2017-04-17 15:03:04 -07:00
Yiming Wu
e881c4c590 removing __all__ in fc, dropout, pooling
Summary: removing __all__ in fc, dropout, pooling

Reviewed By: salexspb

Differential Revision: D4884742

fbshipit-source-id: 4c5cedc9205851b0f3aac6832cebd3d48d0c1e74
2017-04-17 15:03:04 -07:00
Ahmed Taei
a207aa4dbc Fix backward compatibility bug for cnn model helper arguments
Summary:
For new trained models passing kernels=2*[kernel] and using old code for
inference that will not work because (kernels) argument isn't supported and
we are not passing kernel.

Reviewed By: salexspb

Differential Revision: D4888795

fbshipit-source-id: 1649b073c4e1da1d59da9cea581b4dcab6dbaf5c
2017-04-14 09:47:48 -07:00
Aapo Kyrola
580ff3a594 Revert D4854240: [EAZY][C2 OSS] Add normalization helpers and proxy to CNNModelHelper
Summary: This reverts commit 3fa594d79960742b34e20d843e8b6ef8aeb601d3

Differential Revision: D4854240

fbshipit-source-id: d08cb30f188f876e1962f53a44f4e6d4ea68297f
2017-04-12 16:46:01 -07:00
Aapo Kyrola
32b30ff1fe Revert D4854440: [EASY][C2 OSS] Add Nonlinearity helpers and proxy to CNNModelHelper
Summary: This reverts commit a337e5279729f1c938f34b3994ab8827ee94aa93

Differential Revision: D4854440

fbshipit-source-id: 00ef9724654990356be9df9bb1f65b4fd0fd0ffc
2017-04-12 16:36:33 -07:00
Aapo Kyrola
a8ef3b4090 Revert D4855073: [EAZY][C2 OSS] Add array_helpers and proxy to CNN
Summary: This reverts commit 7272f62cff5d065eb028b8118a1ca190bd801fd5

Differential Revision: D4855073

fbshipit-source-id: a121e6bb98c37c7af0b59efad275e00bd5d21163
2017-04-12 16:36:33 -07:00
Aapo Kyrola
7867262d39 Revert D4855040: [EASY][C2 OSS] Add Algebra and train helpers and proxy them to CNNMH
Summary: This reverts commit d948ea913f674a6e47c4b72629a2d33253cb3130

Differential Revision: D4855040

fbshipit-source-id: c8efa9566a3ec6b9a9d3ad0e8cab3cc656627473
2017-04-12 16:36:32 -07:00
Yiming Wu
8de1ce57d2 Add Algebra and train helpers and proxy them to CNNMH
Summary: Add Algebra and train helpers and proxy them to CNNMH

Reviewed By: salexspb

Differential Revision: D4855040

fbshipit-source-id: d948ea913f674a6e47c4b72629a2d33253cb3130
2017-04-11 23:03:00 -07:00
Yiming Wu
b2e94a7bcb Add array_helpers and proxy to CNN
Reviewed By: salexspb

Differential Revision: D4855073

fbshipit-source-id: 7272f62cff5d065eb028b8118a1ca190bd801fd5
2017-04-11 23:02:59 -07:00
Yiming Wu
e7cdd90490 Add Nonlinearity helpers and proxy to CNNModelHelper
Summary: Add Nonlinearity helpers and proxy to CNNModelHelper

Reviewed By: salexspb

Differential Revision: D4854440

fbshipit-source-id: a337e5279729f1c938f34b3994ab8827ee94aa93
2017-04-11 23:02:59 -07:00
Yiming Wu
b8f2baec8e Add normalization helpers and proxy to CNNModelHelper
Summary: Add normalization helpers and proxy to CNNModelHelper

Reviewed By: salexspb

Differential Revision: D4854240

fbshipit-source-id: 3fa594d79960742b34e20d843e8b6ef8aeb601d3
2017-04-11 23:02:59 -07:00
Yiming Wu
d35b7569db Add Pooling Helpers, proxy to CNNModelHelper
Summary: Add Pooling Helpers, proxy to CNNModelHelper

Reviewed By: salexspb

Differential Revision: D4854014

fbshipit-source-id: 672fcd886153136b707866400b2705544eaf4ec9
2017-04-11 23:02:59 -07:00
Yiming Wu
64599d8351 create helpers package and add dropout
Summary: Helpers package and Dropout helper file

Reviewed By: salexspb

Differential Revision: D4837140

fbshipit-source-id: cd3030974421ce6830747935183e098aa04b2803
2017-04-07 17:33:49 -07:00
Aapo Kyrola
8c769258f8 fix cnn.Softmax when called with only inputs
Summary: Many dper code was callling model_helper.Softmax() without outputs, causing python error.. Sorry!

Reviewed By: xianjiec

Differential Revision: D4845359

fbshipit-source-id: 7b6d547acb968371bf7cae1eb68fb5a8609877ec
2017-04-06 15:33:54 -07:00
Yiming Wu
b922b19bfd add weights bias to modelhelperbase
Summary: add weights and bias to modelhelperbase

Reviewed By: salexspb

Differential Revision: D4837125

fbshipit-source-id: 6a357c0e3d07d35aa6cdeb8ef803976646b9dbe6
2017-04-06 11:16:55 -07:00
Aapo Kyrola
c66c8f6e84 Add Softmax to cnn.py, cuDNN engine.
Summary: Softmax was not in the model helper, so added it there so we can set the CUDNN engine, as it is the preferred version.

Reviewed By: asaadaldien

Differential Revision: D4835624

fbshipit-source-id: 7f0c84b7a73653119901795782709a6a617345c5
2017-04-05 14:20:23 -07:00
Aapo Kyrola
e13e9c1302 cuDNN version of TransposeOp
Summary:
Uses the cudnnTransformTensor function. It works by shuffling the strides according to the transpose axis. Significant speedup over current GPU version .
+ moves the transpose test under utility_ops, because hypothesis_test is too big

Reviewed By: jamesr66a

Differential Revision: D4810993

fbshipit-source-id: 82577c4ced1389e70bd5992820ae4d8297a3817f
2017-04-03 13:33:10 -07:00
Aaron Markham
58f7f2b441 doxygen python block added
Summary: Closes https://github.com/caffe2/caffe2/pull/226

Differential Revision: D4793550

Pulled By: JoelMarcey

fbshipit-source-id: cc33e58186304fa8dcac2ee9115dcc271d785b1e
2017-03-29 06:46:16 -07:00
Ahmed Taei
3b7cb50d1c Add ConvNd to model helper
Summary:
Add ConvNd interface for Nd  convluton and keep Conv for 2d convlution.
I added _BaseConv to share code between ConvNd and Conv.

Reviewed By: Yangqing

Differential Revision: D4660822

fbshipit-source-id: 8339421351ce9a36ce5a165f7fa455cfcc61733d
2017-03-22 15:47:48 -07:00
Alexander Sidorov
f97d7949d0 Remove legacy LSTM, cleanup tests
Summary: we don't use this one any more except a few tests

Reviewed By: urikz

Differential Revision: D4731401

fbshipit-source-id: c5c28b7594e3251f501fc28455dfc9bd2093a836
2017-03-17 16:33:53 -07:00
Alexander Sidorov
1fac027d0e Quantized Training API
Summary: These python helpers are going to provide sufficient book keeping when adding quantization for conv layers

Reviewed By: Yangqing

Differential Revision: D4671478

fbshipit-source-id: 292e2f633dd30969c0afbe7a8075b340ce9a6d12
2017-03-13 22:17:58 -07:00
Pooya Davoodi
d85ca8c6df Do not initialize BN params if init_params is false.
Summary:
If init_params is False, the parameters should not be initialized.
This is particularly important when testing a model that provides values for these BN parameters.
Closes https://github.com/caffe2/caffe2/pull/174

Differential Revision: D4621791

Pulled By: Yangqing

fbshipit-source-id: 518443925990a12c1d5729b0971ebe19ba5d8998
2017-02-27 20:19:03 -08:00
Aapo Kyrola
9eeeb8407f use CUDA version of AccuracyOp with top_k=1
Summary: D4348953 added support for accuracy for top_k>1, which is only supported on CPU, requiring data to be copied to CUDA. But that diff did not take into account that we have top_k=1 version of AccuracyOp for CUDA. This diff ensures we use the CUDA version for top_k=1.

Differential Revision: D4607767

fbshipit-source-id: 8becda23890343043eb79ad04e4c6196e9010f0c
2017-02-23 19:02:53 -08:00
Kittipat Virochsiri
ba7fad53b5 Support for sample softmax
Summary:
This diff adds ability to train multiclass classifier on sampled subset of classes. This basically implements what described in https://arxiv.org/abs/1412.2007 without the sampling probability correction. Since this implement uniform sampling, sampling probabilities are cancelled out in softmax anyway.

The trick to make this work is to have 2 different nets for prediction and training, both shared parameters. The model is built normally until the last layer. If sampling is needed, then we do the following:

The class sampling works as following:

Reviewed By: xianjiec

Differential Revision: D4512859

fbshipit-source-id: ab537bcac81d5e5877a8795045e8682c8064da68
2017-02-17 09:31:54 -08:00
James Cross
b436788b16 LSTMUnit: pass through H values
Summary:
Pass through the h-value recurrent output unchanged at each LSTM step beyond the valid part of a sequence (computed based on seqLengths, allowing batching of sequences of different length). This enables using the final-step output of each sequence as the output when one vector is desired for the entire sequence. Gradient also passed back unchanged.

Also made some cosmetic changes to recurrent_network_test.py (seq_lengths offset corrected, should be in [1, T] rather than [0, T-1]).

Reviewed By: urikz

Differential Revision: D4540307

fbshipit-source-id: 73a9f6326069d713dcb0cdc8d17869317c6dbe96
2017-02-16 15:31:38 -08:00
James Cross
63901e9aca allow recurrent network gradient op to receive gradient on any combination of network output blobs
Summary:
(Caffe2) Modified RecurrentNetworkGradient operator so that training is possible with any of the output blob(s) receiving gradient during the backward pass. This is realized through a new argument for the RecurrentNetwork op, outputs_with_grads, which takes a list of the indices of the output blobs which will receive gradient. The default case (only receiving gradient from the first output blob) remains the default.

New unit test covers the case where outputs_with_grads = [1, 2] using Python LSTM wrapper.

Reviewed By: urikz

Differential Revision: D4518516

fbshipit-source-id: 5c531582b20f3cf727d1aa91239b4d5a2b8a7c1f
2017-02-15 16:00:45 -08:00
David Truong
60be25f4cd Added shape inference to padding operator for tensors
Summary: Can now infer the shape of the tensor

Differential Revision: D4529339

fbshipit-source-id: 33553611fd3ecd7fde4b7b432c7720255ddda8be
2017-02-13 11:04:13 -08:00