Skip to content

Commit fa99099

Browse files
authored
Merge pull request pytorch#105 from iotamudelta/master
Merge from upstream
2 parents 1f3544f + 410d539 commit fa99099

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+189
-126
lines changed

aten/src/ATen/code_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212

1313
class CodeTemplate(object):
14-
substitution_str = '(^[^\n\S]*)?\$([^\d\W]\w*|\{,?[^\d\W]\w*\,?})'
14+
substitution_str = r'(^[^\n\S]*)?\$([^\d\W]\w*|\{,?[^\d\W]\w*\,?})'
1515

1616
# older versions of Python have a bug where \w* does not work,
1717
# so we need to replace with the non-shortened version [a-zA-Z0-9_]*
1818
# https://bugs.python.org/issue18647
1919

20-
substitution_str = substitution_str.replace('\w', '[a-zA-Z0-9_]')
20+
substitution_str = substitution_str.replace(r'\w', r'[a-zA-Z0-9_]')
2121

2222
subtitution = re.compile(substitution_str, re.MULTILINE)
2323

aten/src/ATen/core/Macros.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
// Disable the copy and assignment operator for a class. Note that this will
2525
// disable the usage of the class in std containers.
26-
#ifndef DISABLE_COPY_AND_ASSIGN
27-
#define DISABLE_COPY_AND_ASSIGN(classname) \
28-
classname(const classname&) = delete; \
26+
#define AT_DISABLE_COPY_AND_ASSIGN(classname) \
27+
classname(const classname&) = delete; \
2928
classname& operator=(const classname&) = delete
30-
#endif

aten/src/ATen/core/TensorTypeIdRegistration.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TensorTypeIdCreator final {
3232
static constexpr at::TensorTypeId max_id_ = TensorTypeId(
3333
std::numeric_limits<details::_tensorTypeId_underlyingType>::max());
3434

35-
DISABLE_COPY_AND_ASSIGN(TensorTypeIdCreator);
35+
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdCreator);
3636
};
3737

3838
class TensorTypeIdRegistry final {
@@ -46,7 +46,7 @@ class TensorTypeIdRegistry final {
4646
std::unordered_set<at::TensorTypeId> registeredTypeIds_;
4747
std::mutex mutex_;
4848

49-
DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistry);
49+
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistry);
5050
};
5151

5252
class TensorTypeIds final {
@@ -64,7 +64,7 @@ class TensorTypeIds final {
6464
TensorTypeIdCreator creator_;
6565
TensorTypeIdRegistry registry_;
6666

67-
DISABLE_COPY_AND_ASSIGN(TensorTypeIds);
67+
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIds);
6868
};
6969

7070
inline constexpr at::TensorTypeId TensorTypeIds::undefined() noexcept {
@@ -81,7 +81,7 @@ class TensorTypeIdRegistrar final {
8181
private:
8282
at::TensorTypeId id_;
8383

84-
DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistrar);
84+
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistrar);
8585
};
8686

8787
inline at::TensorTypeId TensorTypeIdRegistrar::id() const noexcept {

aten/src/ATen/preprocess_declarations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def should_generate_out_variant(option):
124124

125125
def sanitize_return(option):
126126
ret = option['return']
127-
m = re.match('argument (\d+(,\d+)*)', ret)
127+
m = re.match(r'argument (\d+(,\d+)*)', ret)
128128
if m is not None:
129129
arguments = [int(x) for x in m.group(1).split(',')]
130130
option['return'] = {'kind': 'arguments', 'arguments': arguments}

aten/src/THC/THCReduce.cuh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ bool THC_reduceDim(THCState* state,
517517
(TYPE) outElements, init, modifyOp, reduceOp, finalizeOp); \
518518
} \
519519
else \
520-
{ \
521-
void* stagingData; \
522-
void* semaphores; \
520+
{ \
521+
void* stagingData = nullptr; \
522+
void* semaphores = nullptr; \
523523
\
524524
if(grid.y > 1) \
525525
{ \

caffe2/contrib/nccl/cuda_nccl_gpu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class NCCLContext {
7272
cudaEvent_t master_event_;
7373
std::vector<cudaEvent_t> events_;
7474

75-
DISABLE_COPY_AND_ASSIGN(NCCLContext);
75+
AT_DISABLE_COPY_AND_ASSIGN(NCCLContext);
7676
};
7777

7878
// We share the contexts across multiple operators, hence the

caffe2/core/blob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class Blob {
288288
void* pointer_ = nullptr;
289289
DestroyCall destroy_ = nullptr;
290290

291-
DISABLE_COPY_AND_ASSIGN(Blob);
291+
AT_DISABLE_COPY_AND_ASSIGN(Blob);
292292
};
293293

294294
inline void swap(Blob& lhs, Blob& rhs) {

caffe2/core/common_cudnn.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class cudnnTensorDescWrapper {
259259
cudnnTensorFormat_t format_;
260260
cudnnDataType_t type_;
261261
vector<int> dims_;
262-
DISABLE_COPY_AND_ASSIGN(cudnnTensorDescWrapper);
262+
AT_DISABLE_COPY_AND_ASSIGN(cudnnTensorDescWrapper);
263263
};
264264

265265
class cudnnFilterDescWrapper {
@@ -313,7 +313,7 @@ class cudnnFilterDescWrapper {
313313
StorageOrder order_;
314314
cudnnDataType_t type_;
315315
vector<int> dims_;
316-
DISABLE_COPY_AND_ASSIGN(cudnnFilterDescWrapper);
316+
AT_DISABLE_COPY_AND_ASSIGN(cudnnFilterDescWrapper);
317317
};
318318

319319

caffe2/core/cudnn_wrappers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class CuDNNState {
8989
cudaStream_t stream_{nullptr};
9090
CuDNNWorkspace workspace_;
9191
size_t gpu_id_{0};
92-
DISABLE_COPY_AND_ASSIGN(CuDNNState);
92+
AT_DISABLE_COPY_AND_ASSIGN(CuDNNState);
9393
};
9494

9595
/**
@@ -153,7 +153,7 @@ class CuDNNWrapper {
153153
CAFFE2_COMPILE_TIME_MAX_GPUS>;
154154
static PerGPUCuDNNStates& cudnn_states();
155155

156-
DISABLE_COPY_AND_ASSIGN(CuDNNWrapper);
156+
AT_DISABLE_COPY_AND_ASSIGN(CuDNNWrapper);
157157
};
158158

159159
}; // namespace caffe2

caffe2/core/db.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MiniDBTransaction : public Transaction {
119119
FILE* file_;
120120
std::lock_guard<std::mutex> lock_;
121121

122-
DISABLE_COPY_AND_ASSIGN(MiniDBTransaction);
122+
AT_DISABLE_COPY_AND_ASSIGN(MiniDBTransaction);
123123
};
124124

125125
class MiniDB : public DB {

0 commit comments

Comments
 (0)