Skip to content

Commit 52a5b55

Browse files
author
Christian Puhrsch
committed
NestedTensor class
1 parent 351a6b8 commit 52a5b55

16 files changed

+2166
-0
lines changed

.gitignore

+242
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
# READ THIS BEFORE YOU REFACTOR ME
2+
#
3+
# setup.py uses the list of patterns in this file to decide
4+
# what to delete, but it's not 100% sound. So, for example,
5+
# if you delete aten/build/ because it's redundant with build/,
6+
# aten/build/ will stop being cleaned. So be careful when
7+
# refactoring this file!
8+
9+
## PyTorch
10+
11+
.mypy_cache
12+
*/*.pyc
13+
*/*.so*
14+
*/**/__pycache__
15+
*/**/*.dylib*
16+
*/**/*.pyc
17+
*/**/*.pyd
18+
*/**/*.so*
19+
*/**/**/*.pyc
20+
*/**/**/**/*.pyc
21+
*/**/**/**/**/*.pyc
22+
aten/build/
23+
aten/src/ATen/Config.h
24+
aten/src/ATen/cuda/CUDAConfig.h
25+
caffe2/cpp_test/
26+
dist/
27+
docs/src/**/*
28+
docs/cpp/build
29+
docs/cpp/source/api
30+
test/.coverage
31+
test/.hypothesis/
32+
test/cpp/api/mnist
33+
test/custom_operator/model.pt
34+
test/data/legacy_modules.t7
35+
test/data/*.pt
36+
dropout_model.pt
37+
test/generated_type_hints_smoketest.py
38+
test/htmlcov
39+
test/cpp_extensions/install/
40+
third_party/build/
41+
tools/shared/_utils_internal.py
42+
torch.egg-info/
43+
torch/__init__.pyi
44+
torch/nn/functional.pyi
45+
torch/nn/modules/*.pyi
46+
torch/csrc/autograd/generated/*
47+
torch/csrc/cudnn/cuDNN.cpp
48+
torch/csrc/generated
49+
torch/csrc/generic/TensorMethods.cpp
50+
torch/csrc/jit/generated/*
51+
torch/csrc/jit/fuser/config.h
52+
torch/csrc/nn/THCUNN.cpp
53+
torch/csrc/nn/THCUNN.cwrap
54+
torch/csrc/nn/THNN_generic.cpp
55+
torch/csrc/nn/THNN_generic.cwrap
56+
torch/csrc/nn/THNN_generic.h
57+
torch/csrc/nn/THNN.cpp
58+
torch/csrc/nn/THNN.cwrap
59+
torch/bin/
60+
torch/cmake/
61+
torch/lib/*.a*
62+
torch/lib/*.dll*
63+
torch/lib/*.exe*
64+
torch/lib/*.dylib*
65+
torch/lib/*.h
66+
torch/lib/*.lib
67+
torch/lib/*.so*
68+
torch/lib/protobuf*.pc
69+
torch/lib/build
70+
torch/lib/caffe2/
71+
torch/lib/cmake
72+
torch/lib/include
73+
torch/lib/pkgconfig
74+
torch/lib/protoc
75+
torch/lib/protobuf/
76+
torch/lib/tmp_install
77+
torch/lib/torch_shm_manager
78+
torch/lib/site-packages/
79+
torch/lib/python*
80+
torch/lib64
81+
torch/include/
82+
torch/share/
83+
torch/test/
84+
torch/version.py
85+
# Root level file used in CI to specify certain env configs.
86+
# E.g., see .circleci/config.yaml
87+
env
88+
.circleci/scripts/COMMIT_MSG
89+
90+
# IPython notebook checkpoints
91+
.ipynb_checkpoints
92+
93+
# Editor temporaries
94+
*.swn
95+
*.swo
96+
*.swp
97+
*.swm
98+
*~
99+
100+
# macOS dir files
101+
.DS_Store
102+
103+
# Symbolic files
104+
tools/shared/cwrap_common.py
105+
106+
# Ninja files
107+
.ninja_deps
108+
.ninja_log
109+
compile_commands.json
110+
*.egg-info/
111+
docs/source/scripts/activation_images/
112+
113+
## General
114+
115+
# Compiled Object files
116+
*.slo
117+
*.lo
118+
*.o
119+
*.cuo
120+
*.obj
121+
122+
# Compiled Dynamic libraries
123+
*.so
124+
*.dylib
125+
*.dll
126+
127+
# Compiled Static libraries
128+
*.lai
129+
*.la
130+
*.a
131+
*.lib
132+
133+
# Compiled protocol buffers
134+
*.pb.h
135+
*.pb.cc
136+
*_pb2.py
137+
138+
# Compiled python
139+
*.pyc
140+
*.pyd
141+
142+
# Compiled MATLAB
143+
*.mex*
144+
145+
# IPython notebook checkpoints
146+
.ipynb_checkpoints
147+
148+
# Editor temporaries
149+
*.swn
150+
*.swo
151+
*.swp
152+
*~
153+
154+
# Sublime Text settings
155+
*.sublime-workspace
156+
*.sublime-project
157+
158+
# Eclipse Project settings
159+
*.*project
160+
.settings
161+
162+
# QtCreator files
163+
*.user
164+
165+
# PyCharm files
166+
.idea
167+
168+
# OSX dir files
169+
.DS_Store
170+
171+
# GDB history
172+
.gdb_history
173+
174+
## Caffe2
175+
176+
# build, distribute, and bins (+ python proto bindings)
177+
build
178+
build_host_protoc
179+
build_android
180+
build_ios
181+
/build_*
182+
.build_debug/*
183+
.build_release/*
184+
distribute/*
185+
*.testbin
186+
*.bin
187+
cmake_build
188+
.cmake_build
189+
gen
190+
.setuptools-cmake-build
191+
.pytest_cache
192+
aten/build/*
193+
194+
# Bram
195+
plsdontbreak
196+
197+
# Generated documentation
198+
docs/_site
199+
docs/gathered
200+
_site
201+
doxygen
202+
docs/dev
203+
204+
# LevelDB files
205+
*.sst
206+
*.ldb
207+
LOCK
208+
CURRENT
209+
MANIFEST-*
210+
211+
# generated version file
212+
caffe2/version.py
213+
214+
# setup.py intermediates
215+
.eggs
216+
caffe2.egg-info
217+
218+
# Atom/Watchman required file
219+
.watchmanconfig
220+
221+
# Files generated by CLion
222+
cmake-build-debug
223+
224+
# Files generated by ctags
225+
CTAGS
226+
tags
227+
TAGS
228+
229+
# BEGIN NOT-CLEAN-FILES (setup.py handles this marker. Do not change.)
230+
#
231+
# Below files are not deleted by "setup.py clean".
232+
233+
# Visual Studio Code files
234+
.vscode
235+
.vs
236+
237+
# YouCompleteMe config file
238+
.ycm_extra_conf.py
239+
240+
# Files generated when a patch is rejected
241+
*.orig
242+
*.rej

nestedtensor/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import torch
2+
if getattr(torch, "__IS_MONKEY_PATCHED_BY_NESTED_TENSOR", None) is None:
3+
from .nested.monkey_patch import monkey_patch
4+
torch = monkey_patch(torch)
5+
# Confirm that this function was only applied once
6+
assert torch.__IS_MONKEY_PATCHED_BY_NESTED_TENSOR == 1
7+
8+
from .nested.utils import tensorwise

nestedtensor/nested/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)