Skip to content

Commit fa99099

Browse files
authored
Merge pull request #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 {

caffe2/core/db.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Cursor {
5252
*/
5353
virtual bool Valid() = 0;
5454

55-
DISABLE_COPY_AND_ASSIGN(Cursor);
55+
AT_DISABLE_COPY_AND_ASSIGN(Cursor);
5656
};
5757

5858
/**
@@ -71,7 +71,7 @@ class Transaction {
7171
*/
7272
virtual void Commit() = 0;
7373

74-
DISABLE_COPY_AND_ASSIGN(Transaction);
74+
AT_DISABLE_COPY_AND_ASSIGN(Transaction);
7575
};
7676

7777
/**
@@ -99,7 +99,7 @@ class DB {
9999
protected:
100100
Mode mode_;
101101

102-
DISABLE_COPY_AND_ASSIGN(DB);
102+
AT_DISABLE_COPY_AND_ASSIGN(DB);
103103
};
104104

105105
// Database classes are registered by their names so we can do optional
@@ -285,7 +285,7 @@ class DBReader {
285285
uint32_t num_shards_;
286286
uint32_t shard_id_;
287287

288-
DISABLE_COPY_AND_ASSIGN(DBReader);
288+
AT_DISABLE_COPY_AND_ASSIGN(DBReader);
289289
};
290290

291291
class DBReaderSerializer : public BlobSerializerBase {

caffe2/core/dispatch/KernelRegistration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class KernelRegistrar final {
5757
const typename Schema::dispatch::dispatch_key_type dispatch_key_;
5858
bool owns_registration_;
5959

60-
DISABLE_COPY_AND_ASSIGN(KernelRegistrar);
60+
AT_DISABLE_COPY_AND_ASSIGN(KernelRegistrar);
6161
};
6262

6363
/**

caffe2/core/hip/common_miopen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class miopenTensorDescWrapper
164164
miopenTensorDescriptor_t desc_;
165165
miopenDataType_t type_;
166166
vector<int> dims_;
167-
DISABLE_COPY_AND_ASSIGN(miopenTensorDescWrapper);
167+
AT_DISABLE_COPY_AND_ASSIGN(miopenTensorDescWrapper);
168168
};
169169

170170
} // namespace caffe2

caffe2/core/hip/miopen_wrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class MIOPENState
9292
hipStream_t stream_{nullptr};
9393
MIOPENWorkspace workspace_;
9494
size_t gpu_id_{0};
95-
DISABLE_COPY_AND_ASSIGN(MIOPENState);
95+
AT_DISABLE_COPY_AND_ASSIGN(MIOPENState);
9696
};
9797

9898
/**
@@ -157,7 +157,7 @@ class MIOPENWrapper
157157
CAFFE2_COMPILE_TIME_MAX_HIP_GPUS>;
158158
static PerGPUMIOPENStates& miopen_states();
159159

160-
DISABLE_COPY_AND_ASSIGN(MIOPENWrapper);
160+
AT_DISABLE_COPY_AND_ASSIGN(MIOPENWrapper);
161161
};
162162

163163
}; // namespace caffe2

caffe2/core/hip/net_async_dag_hip.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ProfiledRange
5858
ProfiledRange(const OperatorDef& def, Color color) {}
5959

6060
private:
61-
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
61+
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
6262
};
6363

6464
} // namespace

caffe2/core/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class NetBase : public Observable<NetBase> {
124124
string name_;
125125
vector<const Event*> events_;
126126
std::shared_ptr<const NetDef> net_def_;
127-
DISABLE_COPY_AND_ASSIGN(NetBase);
127+
AT_DISABLE_COPY_AND_ASSIGN(NetBase);
128128
};
129129

130130
class ExecutorHelper {

caffe2/core/net_async_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class AsyncNetBase : public NetBase {
125125
bool use_per_net_pools_;
126126
bool is_blocking_;
127127

128-
DISABLE_COPY_AND_ASSIGN(AsyncNetBase);
128+
AT_DISABLE_COPY_AND_ASSIGN(AsyncNetBase);
129129

130130
private:
131131
void storeExceptionPtr();

caffe2/core/net_async_dag_gpu.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ProfiledRange {
7171

7272
private:
7373
nvtxRangeId_t range_ = 0;
74-
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
74+
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
7575
};
7676

7777
#else
@@ -81,7 +81,7 @@ class ProfiledRange {
8181
ProfiledRange(const OperatorDef& def, Color color) {}
8282

8383
private:
84-
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
84+
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
8585
};
8686

8787
#endif // ifdef CAFFE2_USE_NVTX

caffe2/core/net_async_dag_gpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AsyncDAGNet : public DAGNetBase {
3232
int stream(const DeviceOption& device_option);
3333
static thread_local std::vector<int> stream_counters_;
3434

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

3838
} // namespace caffe2

caffe2/core/net_async_polling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AsyncPollingNet : public AsyncNetBase {
4040
void reset() override;
4141
std::atomic<bool> has_chain_failed_;
4242

43-
DISABLE_COPY_AND_ASSIGN(AsyncPollingNet);
43+
AT_DISABLE_COPY_AND_ASSIGN(AsyncPollingNet);
4444
};
4545

4646
} // namespace caffe2

caffe2/core/net_async_scheduling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AsyncSchedulingNet : public AsyncNetBase {
3030

3131
std::atomic<int> processed_tasks_num_;
3232

33-
DISABLE_COPY_AND_ASSIGN(AsyncSchedulingNet);
33+
AT_DISABLE_COPY_AND_ASSIGN(AsyncSchedulingNet);
3434
};
3535

3636
} // namespace caffe2

caffe2/core/net_dag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class DAGNetBase : public NetBase {
8484
mutable std::vector<DAGNetStats> stats_;
8585
std::unordered_map<int, std::unique_ptr<Timer>> task_timers_;
8686

87-
DISABLE_COPY_AND_ASSIGN(DAGNetBase);
87+
AT_DISABLE_COPY_AND_ASSIGN(DAGNetBase);
8888
};
8989

9090
class DAGNet : public DAGNetBase {

caffe2/core/net_simple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SimpleNet : public NetBase {
4848

4949
vector<unique_ptr<OperatorBase>> operators_;
5050

51-
DISABLE_COPY_AND_ASSIGN(SimpleNet);
51+
AT_DISABLE_COPY_AND_ASSIGN(SimpleNet);
5252
};
5353

5454
} // namespace caffe2

caffe2/core/net_simple_async.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AsyncSimpleNet : public NetBase {
4343

4444
vector<unique_ptr<OperatorBase>> operators_;
4545

46-
DISABLE_COPY_AND_ASSIGN(AsyncSimpleNet);
46+
AT_DISABLE_COPY_AND_ASSIGN(AsyncSimpleNet);
4747
};
4848

4949
} // namespace caffe2

caffe2/core/operator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ class OperatorBase : public Observable<OperatorBase> {
408408
// An event used by asynchronous execution.
409409
std::unique_ptr<Event> event_;
410410

411-
DISABLE_COPY_AND_ASSIGN(OperatorBase);
411+
AT_DISABLE_COPY_AND_ASSIGN(OperatorBase);
412412
};
413413

414414
// If your operator does not need any specialized contructor or destructor,

caffe2/core/registry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Registry {
108108
CaffeMap<SrcType, string> help_message_;
109109
std::mutex register_mutex_;
110110

111-
DISABLE_COPY_AND_ASSIGN(Registry);
111+
AT_DISABLE_COPY_AND_ASSIGN(Registry);
112112
};
113113

114114
template <class SrcType, class ObjectPtrType, class... Args>

caffe2/core/timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Timer {
4141

4242
protected:
4343
std::chrono::time_point<clock> start_time_;
44-
DISABLE_COPY_AND_ASSIGN(Timer);
44+
AT_DISABLE_COPY_AND_ASSIGN(Timer);
4545
};
4646
}
4747

caffe2/core/workspace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class Workspace {
297297
std::unique_ptr<ThreadPool> thread_pool_;
298298
std::mutex thread_pool_creation_mutex_;
299299

300-
DISABLE_COPY_AND_ASSIGN(Workspace);
300+
AT_DISABLE_COPY_AND_ASSIGN(Workspace);
301301
};
302302

303303
} // namespace caffe2

caffe2/db/create_db_op.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CreateDBOp final : public Operator<Context> {
3434
string db_name_;
3535
uint32_t num_shards_;
3636
uint32_t shard_id_;
37-
DISABLE_COPY_AND_ASSIGN(CreateDBOp);
37+
AT_DISABLE_COPY_AND_ASSIGN(CreateDBOp);
3838
};
3939

4040
} // namespace caffe2

caffe2/db/leveldb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class LevelDBTransaction : public Transaction {
5151
leveldb::DB* db_;
5252
std::unique_ptr<leveldb::WriteBatch> batch_;
5353

54-
DISABLE_COPY_AND_ASSIGN(LevelDBTransaction);
54+
AT_DISABLE_COPY_AND_ASSIGN(LevelDBTransaction);
5555
};
5656

5757
class LevelDB : public DB {

caffe2/db/lmdb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class LMDBTransaction final : public Transaction {
114114
MDB_dbi mdb_dbi_;
115115
MDB_txn* mdb_txn_;
116116

117-
DISABLE_COPY_AND_ASSIGN(LMDBTransaction);
117+
AT_DISABLE_COPY_AND_ASSIGN(LMDBTransaction);
118118
};
119119

120120
class LMDB : public DB {

caffe2/db/protodb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ProtoDBTransaction : public Transaction {
6060
TensorProtos* proto_;
6161
std::unordered_set<string> existing_names_;
6262

63-
DISABLE_COPY_AND_ASSIGN(ProtoDBTransaction);
63+
AT_DISABLE_COPY_AND_ASSIGN(ProtoDBTransaction);
6464
};
6565

6666
class ProtoDB : public DB {

0 commit comments

Comments
 (0)