Commit Graph

42 Commits

Author SHA1 Message Date
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
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
1d5780d42c Remove Apache headers from source.
* LICENSE file contains details, so removing from individual source files.
2018-03-27 13:10:18 -07:00
81898e5d47 Fix for wrong newline in caffe_translator.py (Crop layer translation)
Summary:
- fixed the false newline at the initialization of the crop layer translation which caused the exceptions described in issue #1215
Closes https://github.com/caffe2/caffe2/pull/1746

Differential Revision: D6716228

Pulled By: Yangqing

fbshipit-source-id: dd93b06b3b903f96505d6e6f8e67caeb6981fe66
2018-01-12 16:17:53 -08:00
81284c7a0d Translating Crop to Slice
Summary:
Only works for len(offset) == 1 for now.
Also, Slice Op only supports slicing in one dimension,
can we extend it to support slicing multiple dimensions?

Reviewed By: bwasti

Differential Revision: D5967476

fbshipit-source-id: 6cf9ff510e752ddb3bc9673d47f6a577ae9ccc79
2017-10-03 17:18:32 -07:00
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
fb1c7874ea Deconv translation
Summary: att

Reviewed By: bddppq

Differential Revision: D5865061

fbshipit-source-id: ba27e954771ed40b0284021dee1a766fc8678829
2017-09-26 16:48:10 -07:00
cc3e6ade42 Fix caffe translator
Summary: att

Reviewed By: bddppq

Differential Revision: D5854100

fbshipit-source-id: bebb0fbe36367f973e93cb09c98ec75758829769
2017-09-19 09:21:14 -07:00
63a2b75027 Add option to remove legacy_pad in caffe_translator
Summary:
To speed up deprecating legacy_pad, we added the option
to remove legacy pad in the caffe_translator

Reviewed By: bddppq

Differential Revision: D5724079

fbshipit-source-id: 25465d26f35bd009aa71667c7c523047de42e802
2017-09-14 10:32:48 -07:00
dc13345eb3 Read pretrained weights using binary mode in caffe_translator.py
Summary:
Binary mode must be explicitly specified when reading binary files under windows.
Closes https://github.com/caffe2/caffe2/pull/883

Differential Revision: D5373073

Pulled By: Yangqing

fbshipit-source-id: afedebdc74c954dbb6d24c0bccc192c8712c4c88
2017-07-08 10:17:57 -07:00
4da076d3e9 Fixed typo caffe_translator.py, fixes bug #397
Summary:
Fixed minor typo in python/caffe_translator.py. Fixes #397.
Closes https://github.com/caffe2/caffe2/pull/412

Differential Revision: D4950875

Pulled By: aaronmarkham

fbshipit-source-id: 07183c6d6e8e97451bb5ee5ff01a88553d6bdb82
2017-05-24 12:18:32 -07:00
5989deb707 adding 3d operator translators
Summary: Adding caffe-to-caffe2 translators for Conv3D, Pooling3D, BatchNorm

Differential Revision: D4945495

fbshipit-source-id: fe3c97547507924a1409b977307b928ce78445f3
2017-05-11 23:01:44 -07:00
813452608c Add Reduction layer in caffe_translator
Summary:
Caffe's Reduction corresponds to Caffe2 ReduceBack*. Added a translator for
stephenyan1231's model.

Reviewed By: stephenyan1231

Differential Revision: D4848289

fbshipit-source-id: 7cb61c115549ffa6be8d0c19a5eaed99c3c086b6
2017-04-07 16:17:07 -07:00
acaf279235 Unbreak old model check in caffe_translator
Summary: The check for old model style seems wrong. Fails with a model I tried to run.

Differential Revision: D4847970

fbshipit-source-id: f28c5bb635c5e8b4dcfcc5c52a434d91a89217e8
2017-04-07 12:32:25 -07:00
d8c65cc52a A more deterministic way to find old C1 model
Summary: minor fix about C1 model translator

Reviewed By: Yangqing

Differential Revision: D4807165

fbshipit-source-id: 0149e2655d2901b23a37e92f61d9dd678cf6ee69
2017-03-31 11:51:56 -07:00
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
0276c992b7 translator fix
Summary:
This completes the fix that viswanathgs started in an earlier diff but did not
cover the full Caffe convention. It should have proper guards for all the stuff
that Caffe implies, either supporting it or throwing an explicit exception.

Reviewed By: viswanathgs

Differential Revision: D4751751

fbshipit-source-id: 474e921c33840cff333a631b7b19f881b39ebccd
2017-03-22 15:09:13 -07:00
518d36d34b Add PReLU translator
Summary: Closes https://github.com/caffe2/caffe2/pull/171

Differential Revision: D4711877

Pulled By: Yangqing

fbshipit-source-id: 555f733e6eabf351480b7d4398aa05755cc26599
2017-03-15 02:47:03 -07:00
2b4ec53fcb translator fix to solve Aaron's issue
Summary: TSIA. This is actually https://github.com/caffe2/caffe2/pull/135

Reviewed By: bwasti

Differential Revision: D4552417

fbshipit-source-id: 184c085af91b87f88203c565167f66c66f17c05f
2017-02-13 11:19:13 -08:00
77fd7c2b6f Make translator work as command line tool
Summary: The initial implementation wasn't working quite right (no const fill of an empty external input)

Reviewed By: viswanathgs

Differential Revision: D4490569

fbshipit-source-id: 1b2a4f612efb3b2685edfe6c683571dd9d01aa4f
2017-02-01 13:14:26 -08:00
eba5299576 Port ROIPool to caffe2 trunk, add CPU implementation
Summary:
Xray is being converted to c2 and ROIPool (needed for detection models) is
missing in c2 trunk. Ported rbgirshick's implementation from experimental with a few
changes:

Also added code for translation in caffe_translate.py

Differential Revision: D4453331

fbshipit-source-id: 7a05a88edec1bd6e806e52dc1e6c55bc75c3149f
2017-01-27 12:59:20 -08:00
ca1ff1ee9b Add Flatten layer, bugfix in InnerProduct
Summary: Uncovered these while converting xray detection model.

Differential Revision: D4461051

fbshipit-source-id: 1654c0d7ed101c8c211a93aed6bb542db1e20e0a
2017-01-26 21:44:35 -08:00
9dd1d9428e Made translator work as command line tool
Summary: Might be useful to have a command line version of this. Thoughts?

Reviewed By: Yangqing

Differential Revision: D4456221

fbshipit-source-id: 42dd464c5734c0cfbd4c2b1cb348aef9b269b4c2
2017-01-26 20:29:35 -08:00
a4ba0cceb2 Run memonger to optimize net if needed
Summary: This runs memory optimization on the net.

Differential Revision: D4433788

fbshipit-source-id: 80c3f0568795c2d7a5beb3cdb89a92af91162fef
2017-01-25 15:14:26 -08:00
b5424c9646 Enable top-k accuracy option in caffe_translator
Summary: Caffe2 has a topk accuracy op now

Differential Revision: D4450387

fbshipit-source-id: 2d516cc44fb4e814ca901e73746b0364a0584217
2017-01-23 14:29:24 -08:00
be97f491e6 Unbreak caffe_translator for Conv op
Summary:
Minor bug in D4426513 - bias is added
as input blob always. Running it on xray throws "RuntimeError: [enforce fail at operator.cc:25] blob
!= nullptr. op Conv: Encountered a non-existing input blob:
caffe.SpatialConvolution_0_b"

Reviewed By: Yangqing

Differential Revision: D4429231

fbshipit-source-id: 0d3905ea6e87128ec1aa9d0f0a2f43126b1069b1
2017-01-18 14:00:04 -08:00
e67425647a Support bias for Scale layer in caffe_translate
Summary:
Turns out xray models have some independent Scale layers (with bias) besides
the Conv-Scale pairs. We could still fuse it with previous layers with some
work, but for simplicity, including Add op followed by Mul for bias if needed.
We could revisit optimizations layer fusion in the future once we have
something working for xray.

Reviewed By: Yangqing

Differential Revision: D4427266

fbshipit-source-id: ef7d8677ccd7d10dbd20759eeed378d9bc4522d1
2017-01-18 09:59:21 -08:00
bfca2b86c3 Removed the old group convolution code
Summary: Now that we direct support group convolution, this will no longer be needed. I also took the chance to add dilated convolution and also optional bias.

Reviewed By: prigoyal

Differential Revision: D4426513

fbshipit-source-id: eb2bb0aa619f8ff5f732512570f736bc59cd57dd
2017-01-18 00:44:31 -08:00
d63f58013b Throw error in caffe_translator on Scale layer with bias
Summary: Failing fast instead of swallowing the bias term.

Differential Revision: D4419130

fbshipit-source-id: 98ce0af9a20adecfb027ffe8293ff69910873abc
2017-01-17 09:59:20 -08:00
7d6742f2f5 Tool to convert caffe models to c2 + fixes for xray v10
Summary:
Simple tool similar to caffe_translator_test.py for conversion from caffe to
caffe2. The differences are:

There are a couple of issues that need to be fixed as mentioned in
https://our.intern.facebook.com/intern/tasks?t=15424761, especially related to
the 'legacy_pad' field in conv op.

Differential Revision: D4407146

fbshipit-source-id: ec641f6d7e0cf6cdf2eca21f058b4451635d4a56
2017-01-17 08:59:58 -08:00
8683737410 Caffe translator: match torch pooling
Summary: See code comments: legacy is a legend.

Reviewed By: viswanathgs

Differential Revision: D4414447

fbshipit-source-id: 7cd96778bbc00aff053100871f273b2e1b43c973
2017-01-13 10:59:20 -08:00
238ceab825 fbsync. TODO: check if build files need update. 2016-11-15 00:00:46 -08:00
44509f9f91 fbsync: mostly lint changes, added mkl files 2016-10-11 22:45:06 -07:00
b23e51d467 chunky sync 2016-09-06 15:55:19 -07:00
05512d1e10 sync 2016-08-10 11:02:15 -07:00
c15e45c9bb chunky sync again 2016-08-01 20:58:46 -07:00
3c989347d8 caffe translator with added back legacy pooling support 2016-07-28 23:37:02 -07:00
6463eebc7b chunky sync - build scripts to be written 2016-07-21 10:16:42 -07:00
559053d3a8 chunky sync 2016-05-13 14:43:48 -07:00
0521e1d672 notebook rewrite and grammar bugfix 2016-03-10 17:34:31 -08:00
cf7ca23fc1 make caffe2.python build 2016-03-08 16:48:19 -08:00
9ae880bb6f move pycaffe2 to caffe2.python 2016-03-08 15:45:30 -08:00