Commit Graph

30 Commits

Author SHA1 Message Date
Stanislau Hlebik
b774ce54f8 remediation of S205607
fbshipit-source-id: 798decc90db4f13770e97cdce3c0df7d5421b2a3
2020-07-17 17:19:47 -07:00
Stanislau Hlebik
8fdea489af remediation of S205607
fbshipit-source-id: 5113fe0c527595e4227ff827253b7414abbdf7ac
2020-07-17 17:17:03 -07: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
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
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
ArutyunovG
8e91da4cb3 Windows shared build (#13550)
Summary:
Hi guys,

I'd like to build Caffe2 with more supported options in Windows with Microsoft Visual Studios.
This is the first pull request.
Running scripts/build_windows_shared.bat is able to build Caffe2 with both CMAKE_BUILD_TYPE=Debug and CMAKE_BUILD_TYPE=Release with Visual Studio 14 2015.
CUDA is 9.0, cudnn is 7.0.5, glog, gflags and lmdb are supported on my system.
Python is 3.5, Detectron works from python interface as well.
It was even possible to debug detectron code and step into caffe2_gpu.dll with pdbs built.

What is disappointing, that c10/experimental ops don't build with this Visual Studio generator, I added special option INCLUDE_EXPERIMENTAL_C10_OPS (default ON) to deal with it in build_windows_shared.bat.

After this pull request the next step is to add Visual Studio 2017 support in the script.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13550

Reviewed By: ezyang

Differential Revision: D13042597

Pulled By: orionr

fbshipit-source-id: f313f909f599cd582a1d000eff766eef3a9fc4fc
2018-11-16 12:16:28 -08:00
Orion Reblitz-Richardson
edb34434ab More changes for hidden visibility (#10692)
Summary:
Let's run CI tests to see what fails given the changes that just landed in https://github.com/pytorch/pytorch/pull/10624

cc mingzhe09088 ezyang Yangqing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10692

Reviewed By: mingzhe09088

Differential Revision: D9423617

Pulled By: orionr

fbshipit-source-id: 3bda1f118d13f8dd8e823727c93167cae747d8cf
2018-08-21 13:39:57 -07:00
Yangqing Jia
20c516ac18
[cmake] Make cudnn optional (#8265)
* Make cudnn optional

* Remove cudnn file from cpu file
2018-06-08 02:04:27 -07:00
Marat Dukhan
79b9bbe60f
[caffe2] Use caffe2::stod in lexer (#7591)
std::stod causes build errors on Android
2018-05-15 14:06:24 -07:00
David Lai
4cb79ee8e1 [codemod][caffe2] comment out unused parameters
The changes in this diff comments out unused parameters. All changes are automated using clang-tidy.
This will allow us to enable `-Wunused-parameter` as error.
#accept2ship
2018-03-30 21:00:44 -07:00
Orion Reblitz-Richardson
c18f9b4dea Back out "[codemod] - comment out unused parameters"
Original commit changeset: 8e10b1f1e2ae

@allow-large-files
2018-02-26 10:26:25 -08:00
Orion Reblitz-Richardson
7e9f8af018 [codemod] - comment out unused parameters 2018-02-26 10:26:25 -08:00
Yangqing Jia
efa7c895f6 Misc Windows lint
Summary: Closes https://github.com/caffe2/caffe2/pull/1656

Differential Revision: D6633052

Pulled By: Yangqing

fbshipit-source-id: 5eeb3912fc769cfd06d252f3ed1d8d5f2a207cfc
2017-12-23 20:07:27 -08:00
Peter Goldsborough
ce2a0aa4d8 Add slice and gather syntax
Summary:
Implemented syntactic sugar for the following constructs:

- `x.Gather(y)` can now be written as `x[y]`
- `x.Slice(start, end)` can now be written as `x[start:end]`

For slicing, `start` and/or `end` can be omitted iff `x` is one-dimensional (i.e. a vector). That is, `vector[start:]`, `vector[:end]` and `vector[:]` will work. Doesn't work for higher-dimensional tensors because to emit the start/end indices we need to know the rank of the tensor (since `Slice` requires one entry per dimension of the tensor).

Also added a `getProto()` function so that I could test that the generated code is as expected (i.e. that the syntactic sugar does not affect the structure of the output).

Reviewed By: zdevito

Differential Revision: D6605864

fbshipit-source-id: 786359713a13314c24be2fc07e01486c507404ef
2017-12-19 19:17:01 -08:00
Zachary DeVito
ae60ef12fa Module syntax sugar.
Summary:
Adds modules:

a = Module() # create a module
a.b = 3 # set tensors in module
a.c = 4
b = my_func(a) # pass a module to a function as an argument
c = b.what + 1 # and receive a module as a return
global foo
foo.a.b # translates to Caffe2 name foo/a/b

This should help clean up beam search where many external nets are grouped
into modules.

Reviewed By: jamesr66a

Differential Revision: D6543292

fbshipit-source-id: 349eae0b1609efab4557f94650938e1fa543579d
2017-12-12 12:07:57 -08:00
James Reed
a8b8614efa Fix typo
Summary: Closes https://github.com/caffe2/caffe2/pull/1596

Reviewed By: zdevito

Differential Revision: D6528030

Pulled By: jamesr66a

fbshipit-source-id: feedf272cd6583360e5e20e90de3f02b728566e6
2017-12-08 20:49:36 -08:00
Zachary DeVito
fd2cab9ded Rudimentary schema checking of operators
Summary:
Uses caffe2 operator schema to check # of inputs/outputs.
Falls back to actual schema->Verify so that schema errors get
reported associated with a SourceRange.

Reviewed By: jamesr66a

Differential Revision: D6517136

fbshipit-source-id: 9be89165ea5e717c4cec1d25bbd967df86200d6c
2017-12-07 23:44:28 -08:00
Zachary DeVito
1c6595c8e8 Add function calls and externs
Summary:
Adds the ability for a script function to call another and adds the extern function to register an external Caffe2 Net that can be called by the script.
Closes https://github.com/caffe2/caffe2/pull/1591

Reviewed By: jamesr66a

Differential Revision: D6515877

Pulled By: zdevito

fbshipit-source-id: b893d9e4bacd7389b550ac8a37ad7974b95de749
2017-12-07 23:44:28 -08:00
James Reed
8d8079a7c3 Builtins for {zeros,ones}{,_like}
Summary: Closes https://github.com/caffe2/caffe2/pull/1589

Reviewed By: zdevito

Differential Revision: D6511699

Pulled By: jamesr66a

fbshipit-source-id: d12421a13fec0c2d4f4fe0dc27b0f8a7b93b7c16
2017-12-07 15:48:52 -08:00
James Reed
1fd1eaa119 More complete beam search example w/ init code
Summary: Closes https://github.com/caffe2/caffe2/pull/1588

Reviewed By: zdevito

Differential Revision: D6511524

Pulled By: jamesr66a

fbshipit-source-id: eb19e74918a3f3a4f5e8a1ed68762e5e5c346160
2017-12-07 15:48:51 -08:00
James Reed
71ab6f41ed Post EOS penalty example
Summary: Closes https://github.com/caffe2/caffe2/pull/1586

Reviewed By: zdevito

Differential Revision: D6505863

Pulled By: jamesr66a

fbshipit-source-id: 2778081de32fcf134df7083ab8fa739ec41fd182
2017-12-07 14:47:38 -08:00
Zachary DeVito
a6ff78457f Misc. fixes and improvements
Summary:
* condition if
* True/False literals
* and, or, not
* 0-output expressions, like print
* _ is given a fresh name
* x.foo(...) is desugared to foo(x,...)
* +=, *=
Closes https://github.com/caffe2/caffe2/pull/1581

Reviewed By: jamesr66a

Differential Revision: D6495256

Pulled By: zdevito

fbshipit-source-id: b601d3f9e08fa544881a0c946b4feac24cb7e116
2017-12-06 17:03:33 -08:00
James Reed
098ab27013 Update beam search example to use new features
Summary:
Code looks much nicer after improvements introduced in https://github.com/caffe2/caffe2/pull/1581
Closes https://github.com/caffe2/caffe2/pull/1582

Reviewed By: zdevito

Differential Revision: D6497976

Pulled By: jamesr66a

fbshipit-source-id: 529278a104c0be81aa999a414d89c2f2e0264324
2017-12-06 15:02:43 -08:00
James Reed
6154670e0d Fix test_while case with in-place add op + broadcast
Summary: r = Add(r, r, broadcast=1i) is apparently illegal in caffe2

Reviewed By: zdevito

Differential Revision: D6495190

fbshipit-source-id: 8caddef6d9dbcb0f6f6ff18b39aec5251ab1d1e5
2017-12-05 22:49:00 -08:00
James Reed
188e709885 Beam search example
Summary: Closes https://github.com/caffe2/caffe2/pull/1578

Reviewed By: zdevito

Differential Revision: D6492503

Pulled By: jamesr66a

fbshipit-source-id: a8cd5901a1c799656882706213f3a1b2a6cfe652
2017-12-05 19:53:19 -08:00
James Reed
fef095af9c Set broadcast flag for binary operators
Summary:
lines such as

    output_scores = best_scores_per_hypo + scores_t_squeezed
    hypo_t_int64 = best_indices / 6LL

will emit the respective binary operator (e.g. `Add`, `Div`) with the `broadcast` flag set to 1
Closes https://github.com/caffe2/caffe2/pull/1577

Reviewed By: zdevito

Differential Revision: D6489991

Pulled By: jamesr66a

fbshipit-source-id: 3bef2bd43dfa18659a299cc62affd74f9a763491
2017-12-05 19:53:19 -08:00
James Reed
a53522e560 Implement typed numeric literals
Summary:
1 is an int32
1LL is an int64
1f is a float

Still need:
Parsing out numbers such as 1.0 as integer. 1.0f should work, though
Closes https://github.com/caffe2/caffe2/pull/1576

Reviewed By: zdevito

Differential Revision: D6489944

Pulled By: jamesr66a

fbshipit-source-id: 46aab9483a18a31d883c8c7e3086d3074fa5efac
2017-12-05 19:53:18 -08:00
James Reed
e70b117583 Set of bugfixes for script compiler
Summary:
* Fix typo in negative constant handling "Negate" -> "Negative"
* Fix unpacking constant in parsing elements for a list attribute
* Parse negative signs in constants
* Switch list syntax to use square brackets in attributes
Closes https://github.com/caffe2/caffe2/pull/1572

Reviewed By: zdevito

Differential Revision: D6483286

Pulled By: jamesr66a

fbshipit-source-id: 949e8fd6a96b12efde756bac9da987da0010e153
2017-12-05 16:49:48 -08:00
Yangqing Jia
046c11cd73 Stod
Summary:
This is in order for Android to pass - Android support for string related functions is quite limited.
Closes https://github.com/caffe2/caffe2/pull/1571

Reviewed By: pietern

Differential Revision: D6486079

Pulled By: Yangqing

fbshipit-source-id: f0961e2dde6202bd6506f4fb8a3aea4af1670cb5
2017-12-05 10:48:09 -08:00
Zachary DeVito
6811acbef9 Syntax for control flow in C2
Summary: Experimental code that allows you to write C2 NetDefs directly using python-like syntax. This includes the ability to write native control-flow (if, while) and have it turn into IfOp and WhileOp

Reviewed By: jamesr66a, dzhulgakov

Differential Revision: D6123298

fbshipit-source-id: 25fc078b5769be61ac7fb3aa9a7c95bd88dccc30
2017-11-29 16:47:45 -08:00