Commit Graph

24 Commits

Author SHA1 Message Date
Richard Zou
57fc793650 Add names to repr for named tensors
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23316

Test Plan:
- [namedtensor ci]

gh-metadata: pytorch pytorch 23316 gh/zou3519/80/head

Imported from OSS

Differential Revision: D16494415

Pulled By: zou3519

fbshipit-source-id: e483f57bdb0610d0eadbe70d673e20dc3d3f9502
2019-08-02 11:37:29 -07:00
Richard Zou
8e466b7e21 Add torch._C._BUILD_NAMEDTENSOR() (#23623)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23623

This is a quick, not-user-facing check for if pytorch was built with BUILD_NAMEDTENSOR=1.

Test Plan:
- run tests [namedtensor ci]

gh-metadata: pytorch pytorch 23623 gh/zou3519/85/head

Differential Revision: D16621829

Pulled By: zou3519

fbshipit-source-id: d7e1161dc176bab2c1f953265722daeba1e63102
2019-08-02 11:37:25 -07:00
Richard Zou
08f7f27c6a Fix named tensor build by enabling tensor.is_pinned and removing support for clone() (#23597)
Summary:
`is_pinned` was moved to native_functions.yaml, disabling it for named
tensors. This PR re-enables its usage for named tensors.

I wrote a named inference rule for torch.clone(), but something happened
to it. Disable it for now so we can get the namedtensor ci to be green.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23597

Test Plan: - run tests [namedtensor ci]

Differential Revision: D16581771

Pulled By: zou3519

fbshipit-source-id: 498018cdc55e269bec80634b8c0a63ba5c72914b
2019-07-31 11:48:40 -07:00
Richard Zou
c5482e33e9 Rename tensor.is_named to has_named, expose has_named to python.
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23315

Test Plan:
- [namedtensor ci]

gh-metadata: pytorch pytorch 23315 gh/zou3519/79/head

Imported from OSS

Differential Revision: D16494414

Pulled By: zou3519

fbshipit-source-id: d2d6beb45db9288e5df707b68b6046d783ca9f97
2019-07-31 07:14:07 -07:00
Richard Zou
725e41e955 Enable named tensors for arithmetic, clone, and tensor conversion ops
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23237

Test Plan: Imported from OSS

Differential Revision: D16494416

Pulled By: zou3519

fbshipit-source-id: 29bc390797c99088d50a2b59c3e2402a93562e2c
2019-07-31 07:14:04 -07:00
Richard Zou
437a8b3eed Named inference rule for copy_
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23229

Test Plan: Imported from OSS

Differential Revision: D16494413

Pulled By: zou3519

fbshipit-source-id: 4acb85e5a4ad09bf5f7cbb84cc8d4ceac0cd9967
2019-07-30 07:17:34 -07:00
Richard Zou
505fa83b2f Implement named inference rule for mul
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23193

Test Plan:
- [namedtensor ci]

gh-metadata: pytorch pytorch 23193 gh/zou3519/75/head

Imported from OSS

Differential Revision: D16494401

Pulled By: zou3519

fbshipit-source-id: 0e2395d7de39158ec51feed5da0389715ec52600
2019-07-29 09:58:18 -07:00
Richard Zou
0dcb8755c8 Implement tensor.set_names_, tensor.names setter
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23172

Test Plan:
- [namedtensor ci]

gh-metadata: pytorch pytorch 23172 gh/zou3519/74/head

Imported from OSS

Differential Revision: D16494364

Pulled By: zou3519

fbshipit-source-id: 8d0e26b33346d4eadba30b2e76610f6d7be7c373
2019-07-26 08:50:49 -07:00
Richard Zou
c8a50a26d2 Named inference rule for torch.prod
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23106

Test Plan:
- [namedtensor ci]

Imported from OSS

Differential Revision: D16419175

Pulled By: zou3519

fbshipit-source-id: beb9ef838525c1ea7d7839cb9b8d68028fb4917f
2019-07-26 08:50:45 -07:00
Richard Zou
9817d7e16b Implement named inference rule for torch.sum
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23081

Test Plan:
- New tests [namedtensor ci]

Imported from OSS

Differential Revision: D16419174

Pulled By: zou3519

fbshipit-source-id: 8679f77f121664d0398d7f062a53c0fa37482481
2019-07-26 08:50:40 -07:00
Richard Zou
b4b51ed5ec Implement tensor.size(Dimname), tensor.stride(Dimname)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/22989

Test Plan: Imported from OSS

Differential Revision: D16364437

Pulled By: zou3519

fbshipit-source-id: 393a93fecac27b5d3b1a7f7692590d8fd5e95a5d
2019-07-22 13:11:59 -07:00
Richard Zou
662fe699c5 Named inference rules for some initializer fns
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/22972

Test Plan:
- [namedtensor ci]

Imported from OSS

Differential Revision: D16342782

Pulled By: zou3519

fbshipit-source-id: 25277688ab51e1e98af0e19aeb9c79399171d2fb
2019-07-18 10:04:29 -07:00
Richard Zou
57cec0a720 Named inference rules for split/chunk
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/22971

Test Plan: Imported from OSS

Differential Revision: D16342783

Pulled By: zou3519

fbshipit-source-id: 379edc8eb2f45a82ee8a6320f8285f8f81ea0b1b
2019-07-18 10:04:25 -07:00
Hong Xu
693871ded3 Rename macros and build options NAMEDTENSOR_ENABLED to BUILD_NAMEDTENSOR (#22360)
Summary:
Currently the build system accepts USE_NAMEDTENSOR from the environment
variable and turns it into NAMEDTENSOR_ENABLED when passing to CMake.
This discrepancy does not seem necessary and complicates the build
system. The naming of this build option is also semantically incorrect
("BUILD_" vis-a-vis "USE_").  This commit eradicate this issue before it
is made into a stable release.

The support of NO_NAMEDTENSOR is also removed, since PyTorch has been
quite inconsistent about "NO_*" build options.

 ---

Note: All environment variables with their names starting with `BUILD_` are currently automatically passed to CMake with no need of an additional wrapper.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22360

Differential Revision: D16074509

Pulled By: zou3519

fbshipit-source-id: dc316287e26192118f3c99b945454bc50535b2ae
2019-07-02 11:46:13 -07:00
Richard Zou
f894ef7263 Add smoke test for information fn/method/attrs to test_namedtensor
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/22341

Test Plan:
- `python test/test_namedtensor.py -v` [namedtensor ci]

gh-metadata: pytorch pytorch 22341 gh/zou3519/66/head

Imported from OSS

Differential Revision: D16053440

Pulled By: zou3519

fbshipit-source-id: 400f2e1c136cd7db4346a42b58813e42595ca755
2019-07-01 07:24:54 -07:00
Richard Zou
496e35f76b More named inference rules for pointwise unary ops
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/22308

Test Plan:
- `python test/test_namedtensor.py -v` [namedtensor ci]

gh-metadata: pytorch pytorch 22308 gh/zou3519/65/head

Imported from OSS

Differential Revision: D16053441

Pulled By: zou3519

fbshipit-source-id: 2e8d4cc11d7a711d2b789752a316a11fffc0996e
2019-07-01 07:24:51 -07:00
Richard Zou
177b8bf6e7 Named inference rule for more pointwise ops. (#22268)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22268
ghimport-source-id: c722f9fbb3fc529c872dcccbf58ba1a8c5fcda8e

Test Plan:
- `python test/test_namedtensor.py -v` [namedtensor ci]

Imported from OSS

Differential Revision: D16030549

Pulled By: zou3519

fbshipit-source-id: 5cbb2c8626335a32a22ed8079245a5faa7cf553f
2019-06-27 12:49:36 -07:00
Richard Zou
7732b1a604 Enable named inference for some unary pointwise ops (#22267)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22267
ghimport-source-id: 1566df9a20712cada6ea1209e000c5ff757daa14

Test Plan: Imported from OSS

Differential Revision: D16030550

Pulled By: zou3519

fbshipit-source-id: 183ca1d14dc0fb6f1ee6e114b48c2703c61e11ce
2019-06-27 12:49:32 -07:00
Richard Zou
6386e4d244 Named inference rule for abs. (#22151)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22151
ghimport-source-id: 54c1726b578ac162af817f78df6f540b764e46e3

Test Plan:
- `python test/test_namedtensor.py` [namedtensor ci]

Imported from OSS

Differential Revision: D15970326

Pulled By: zou3519

fbshipit-source-id: 4ea25f0a73bbc24b604d3ded2027eeb4ce800de0
2019-06-27 12:49:25 -07:00
Richard Zou
4bc89bd5a6 Implement tensor.select(Dimname,int) (#21795)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21795
ghimport-source-id: d13af6078a47de1d6045cfbb7d278c378fe734fe

Test Plan: Imported from OSS

Differential Revision: D15833457

Pulled By: zou3519

fbshipit-source-id: fa52aff25ce0e12f31da3eef83ea948b4f7a5d9f
2019-06-21 16:16:45 -07:00
Richard Zou
1aa16d356e named inference rule for tensor.select (#21752)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21752
ghimport-source-id: 95e17087b8c29c9bd88003ae225cb7329d0b67e6

Test Plan:
- `python test/test_namedtensor.py` [namedtensor ci]

gh-metadata: pytorch pytorch 21752 gh/zou3519/50/head

Imported from OSS

Differential Revision: D15833453

Pulled By: zou3519

fbshipit-source-id: 7b51e4137e54712aa9c6274a9e6bb48ab7191b8d
2019-06-17 13:12:49 -07:00
Richard Zou
2b23fac8da Disallow creation of tensors with duplicate names (#21781)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21781
ghimport-source-id: d77e0c97fe0104b4b29571fd5828967399d34fb1

Test Plan:
- `python test/test_namedtensor.py -v` [namedtensor ci]

gh-metadata: pytorch pytorch 21781 gh/zou3519/51/head

Imported from OSS

Differential Revision: D15833454

Pulled By: zou3519

fbshipit-source-id: fca4de83fba4bced615ec3cbd4ce4c441ddfcaf2
2019-06-17 09:59:50 -07:00
Richard Zou
0d6eb209e6 Expose torch.empty(sizes, *, names, ...) to Python (#21648)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21648
ghimport-source-id: 583f155c8ee95967d2f8b9d8df27d94b9e725694

Differential Revision: D15804482

Pulled By: zou3519

fbshipit-source-id: f86520dda479100be2a752e4db8a902167413a83
2019-06-14 11:52:47 -07:00
Richard Zou
83a80d2b31 Add test/test_namedtensor.py (#20168)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20168
ghimport-source-id: 78bd3c4b6bc87c216ce33dba13b61feb87e5fe53

Reviewed By: gchanan

Differential Revision: D15278222

Pulled By: zou3519

fbshipit-source-id: 3bcdb1cb654400350d42464dd9e0d5e0a7116e1e
2019-05-09 09:09:22 -07:00