Skip to content

Merge from upstream #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aten/src/ATen/code_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@


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

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

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

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

Expand Down
6 changes: 2 additions & 4 deletions aten/src/ATen/core/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

// Disable the copy and assignment operator for a class. Note that this will
// disable the usage of the class in std containers.
#ifndef DISABLE_COPY_AND_ASSIGN
#define DISABLE_COPY_AND_ASSIGN(classname) \
classname(const classname&) = delete; \
#define AT_DISABLE_COPY_AND_ASSIGN(classname) \
classname(const classname&) = delete; \
classname& operator=(const classname&) = delete
#endif
8 changes: 4 additions & 4 deletions aten/src/ATen/core/TensorTypeIdRegistration.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TensorTypeIdCreator final {
static constexpr at::TensorTypeId max_id_ = TensorTypeId(
std::numeric_limits<details::_tensorTypeId_underlyingType>::max());

DISABLE_COPY_AND_ASSIGN(TensorTypeIdCreator);
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdCreator);
};

class TensorTypeIdRegistry final {
Expand All @@ -46,7 +46,7 @@ class TensorTypeIdRegistry final {
std::unordered_set<at::TensorTypeId> registeredTypeIds_;
std::mutex mutex_;

DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistry);
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistry);
};

class TensorTypeIds final {
Expand All @@ -64,7 +64,7 @@ class TensorTypeIds final {
TensorTypeIdCreator creator_;
TensorTypeIdRegistry registry_;

DISABLE_COPY_AND_ASSIGN(TensorTypeIds);
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIds);
};

inline constexpr at::TensorTypeId TensorTypeIds::undefined() noexcept {
Expand All @@ -81,7 +81,7 @@ class TensorTypeIdRegistrar final {
private:
at::TensorTypeId id_;

DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistrar);
AT_DISABLE_COPY_AND_ASSIGN(TensorTypeIdRegistrar);
};

inline at::TensorTypeId TensorTypeIdRegistrar::id() const noexcept {
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/preprocess_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def should_generate_out_variant(option):

def sanitize_return(option):
ret = option['return']
m = re.match('argument (\d+(,\d+)*)', ret)
m = re.match(r'argument (\d+(,\d+)*)', ret)
if m is not None:
arguments = [int(x) for x in m.group(1).split(',')]
option['return'] = {'kind': 'arguments', 'arguments': arguments}
Expand Down
6 changes: 3 additions & 3 deletions aten/src/THC/THCReduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ bool THC_reduceDim(THCState* state,
(TYPE) outElements, init, modifyOp, reduceOp, finalizeOp); \
} \
else \
{ \
void* stagingData; \
void* semaphores; \
{ \
void* stagingData = nullptr; \
void* semaphores = nullptr; \
\
if(grid.y > 1) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion caffe2/contrib/nccl/cuda_nccl_gpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class NCCLContext {
cudaEvent_t master_event_;
std::vector<cudaEvent_t> events_;

DISABLE_COPY_AND_ASSIGN(NCCLContext);
AT_DISABLE_COPY_AND_ASSIGN(NCCLContext);
};

// We share the contexts across multiple operators, hence the
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class Blob {
void* pointer_ = nullptr;
DestroyCall destroy_ = nullptr;

DISABLE_COPY_AND_ASSIGN(Blob);
AT_DISABLE_COPY_AND_ASSIGN(Blob);
};

inline void swap(Blob& lhs, Blob& rhs) {
Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/common_cudnn.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class cudnnTensorDescWrapper {
cudnnTensorFormat_t format_;
cudnnDataType_t type_;
vector<int> dims_;
DISABLE_COPY_AND_ASSIGN(cudnnTensorDescWrapper);
AT_DISABLE_COPY_AND_ASSIGN(cudnnTensorDescWrapper);
};

class cudnnFilterDescWrapper {
Expand Down Expand Up @@ -313,7 +313,7 @@ class cudnnFilterDescWrapper {
StorageOrder order_;
cudnnDataType_t type_;
vector<int> dims_;
DISABLE_COPY_AND_ASSIGN(cudnnFilterDescWrapper);
AT_DISABLE_COPY_AND_ASSIGN(cudnnFilterDescWrapper);
};


Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/cudnn_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class CuDNNState {
cudaStream_t stream_{nullptr};
CuDNNWorkspace workspace_;
size_t gpu_id_{0};
DISABLE_COPY_AND_ASSIGN(CuDNNState);
AT_DISABLE_COPY_AND_ASSIGN(CuDNNState);
};

/**
Expand Down Expand Up @@ -153,7 +153,7 @@ class CuDNNWrapper {
CAFFE2_COMPILE_TIME_MAX_GPUS>;
static PerGPUCuDNNStates& cudnn_states();

DISABLE_COPY_AND_ASSIGN(CuDNNWrapper);
AT_DISABLE_COPY_AND_ASSIGN(CuDNNWrapper);
};

}; // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class MiniDBTransaction : public Transaction {
FILE* file_;
std::lock_guard<std::mutex> lock_;

DISABLE_COPY_AND_ASSIGN(MiniDBTransaction);
AT_DISABLE_COPY_AND_ASSIGN(MiniDBTransaction);
};

class MiniDB : public DB {
Expand Down
8 changes: 4 additions & 4 deletions caffe2/core/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Cursor {
*/
virtual bool Valid() = 0;

DISABLE_COPY_AND_ASSIGN(Cursor);
AT_DISABLE_COPY_AND_ASSIGN(Cursor);
};

/**
Expand All @@ -71,7 +71,7 @@ class Transaction {
*/
virtual void Commit() = 0;

DISABLE_COPY_AND_ASSIGN(Transaction);
AT_DISABLE_COPY_AND_ASSIGN(Transaction);
};

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ class DB {
protected:
Mode mode_;

DISABLE_COPY_AND_ASSIGN(DB);
AT_DISABLE_COPY_AND_ASSIGN(DB);
};

// Database classes are registered by their names so we can do optional
Expand Down Expand Up @@ -285,7 +285,7 @@ class DBReader {
uint32_t num_shards_;
uint32_t shard_id_;

DISABLE_COPY_AND_ASSIGN(DBReader);
AT_DISABLE_COPY_AND_ASSIGN(DBReader);
};

class DBReaderSerializer : public BlobSerializerBase {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/dispatch/KernelRegistration.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class KernelRegistrar final {
const typename Schema::dispatch::dispatch_key_type dispatch_key_;
bool owns_registration_;

DISABLE_COPY_AND_ASSIGN(KernelRegistrar);
AT_DISABLE_COPY_AND_ASSIGN(KernelRegistrar);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/hip/common_miopen.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class miopenTensorDescWrapper
miopenTensorDescriptor_t desc_;
miopenDataType_t type_;
vector<int> dims_;
DISABLE_COPY_AND_ASSIGN(miopenTensorDescWrapper);
AT_DISABLE_COPY_AND_ASSIGN(miopenTensorDescWrapper);
};

} // namespace caffe2
Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/hip/miopen_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MIOPENState
hipStream_t stream_{nullptr};
MIOPENWorkspace workspace_;
size_t gpu_id_{0};
DISABLE_COPY_AND_ASSIGN(MIOPENState);
AT_DISABLE_COPY_AND_ASSIGN(MIOPENState);
};

/**
Expand Down Expand Up @@ -157,7 +157,7 @@ class MIOPENWrapper
CAFFE2_COMPILE_TIME_MAX_HIP_GPUS>;
static PerGPUMIOPENStates& miopen_states();

DISABLE_COPY_AND_ASSIGN(MIOPENWrapper);
AT_DISABLE_COPY_AND_ASSIGN(MIOPENWrapper);
};

}; // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/hip/net_async_dag_hip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ProfiledRange
ProfiledRange(const OperatorDef& def, Color color) {}

private:
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
};

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class NetBase : public Observable<NetBase> {
string name_;
vector<const Event*> events_;
std::shared_ptr<const NetDef> net_def_;
DISABLE_COPY_AND_ASSIGN(NetBase);
AT_DISABLE_COPY_AND_ASSIGN(NetBase);
};

class ExecutorHelper {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class AsyncNetBase : public NetBase {
bool use_per_net_pools_;
bool is_blocking_;

DISABLE_COPY_AND_ASSIGN(AsyncNetBase);
AT_DISABLE_COPY_AND_ASSIGN(AsyncNetBase);

private:
void storeExceptionPtr();
Expand Down
4 changes: 2 additions & 2 deletions caffe2/core/net_async_dag_gpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ProfiledRange {

private:
nvtxRangeId_t range_ = 0;
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
};

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

private:
DISABLE_COPY_AND_ASSIGN(ProfiledRange);
AT_DISABLE_COPY_AND_ASSIGN(ProfiledRange);
};

#endif // ifdef CAFFE2_USE_NVTX
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_dag_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AsyncDAGNet : public DAGNetBase {
int stream(const DeviceOption& device_option);
static thread_local std::vector<int> stream_counters_;

DISABLE_COPY_AND_ASSIGN(AsyncDAGNet);
AT_DISABLE_COPY_AND_ASSIGN(AsyncDAGNet);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_polling.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AsyncPollingNet : public AsyncNetBase {
void reset() override;
std::atomic<bool> has_chain_failed_;

DISABLE_COPY_AND_ASSIGN(AsyncPollingNet);
AT_DISABLE_COPY_AND_ASSIGN(AsyncPollingNet);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_async_scheduling.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AsyncSchedulingNet : public AsyncNetBase {

std::atomic<int> processed_tasks_num_;

DISABLE_COPY_AND_ASSIGN(AsyncSchedulingNet);
AT_DISABLE_COPY_AND_ASSIGN(AsyncSchedulingNet);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_dag.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class DAGNetBase : public NetBase {
mutable std::vector<DAGNetStats> stats_;
std::unordered_map<int, std::unique_ptr<Timer>> task_timers_;

DISABLE_COPY_AND_ASSIGN(DAGNetBase);
AT_DISABLE_COPY_AND_ASSIGN(DAGNetBase);
};

class DAGNet : public DAGNetBase {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SimpleNet : public NetBase {

vector<unique_ptr<OperatorBase>> operators_;

DISABLE_COPY_AND_ASSIGN(SimpleNet);
AT_DISABLE_COPY_AND_ASSIGN(SimpleNet);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/net_simple_async.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AsyncSimpleNet : public NetBase {

vector<unique_ptr<OperatorBase>> operators_;

DISABLE_COPY_AND_ASSIGN(AsyncSimpleNet);
AT_DISABLE_COPY_AND_ASSIGN(AsyncSimpleNet);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class OperatorBase : public Observable<OperatorBase> {
// An event used by asynchronous execution.
std::unique_ptr<Event> event_;

DISABLE_COPY_AND_ASSIGN(OperatorBase);
AT_DISABLE_COPY_AND_ASSIGN(OperatorBase);
};

// If your operator does not need any specialized contructor or destructor,
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Registry {
CaffeMap<SrcType, string> help_message_;
std::mutex register_mutex_;

DISABLE_COPY_AND_ASSIGN(Registry);
AT_DISABLE_COPY_AND_ASSIGN(Registry);
};

template <class SrcType, class ObjectPtrType, class... Args>
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Timer {

protected:
std::chrono::time_point<clock> start_time_;
DISABLE_COPY_AND_ASSIGN(Timer);
AT_DISABLE_COPY_AND_ASSIGN(Timer);
};
}

Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/workspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class Workspace {
std::unique_ptr<ThreadPool> thread_pool_;
std::mutex thread_pool_creation_mutex_;

DISABLE_COPY_AND_ASSIGN(Workspace);
AT_DISABLE_COPY_AND_ASSIGN(Workspace);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/db/create_db_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CreateDBOp final : public Operator<Context> {
string db_name_;
uint32_t num_shards_;
uint32_t shard_id_;
DISABLE_COPY_AND_ASSIGN(CreateDBOp);
AT_DISABLE_COPY_AND_ASSIGN(CreateDBOp);
};

} // namespace caffe2
Expand Down
2 changes: 1 addition & 1 deletion caffe2/db/leveldb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LevelDBTransaction : public Transaction {
leveldb::DB* db_;
std::unique_ptr<leveldb::WriteBatch> batch_;

DISABLE_COPY_AND_ASSIGN(LevelDBTransaction);
AT_DISABLE_COPY_AND_ASSIGN(LevelDBTransaction);
};

class LevelDB : public DB {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/db/lmdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class LMDBTransaction final : public Transaction {
MDB_dbi mdb_dbi_;
MDB_txn* mdb_txn_;

DISABLE_COPY_AND_ASSIGN(LMDBTransaction);
AT_DISABLE_COPY_AND_ASSIGN(LMDBTransaction);
};

class LMDB : public DB {
Expand Down
2 changes: 1 addition & 1 deletion caffe2/db/protodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ProtoDBTransaction : public Transaction {
TensorProtos* proto_;
std::unordered_set<string> existing_names_;

DISABLE_COPY_AND_ASSIGN(ProtoDBTransaction);
AT_DISABLE_COPY_AND_ASSIGN(ProtoDBTransaction);
};

class ProtoDB : public DB {
Expand Down
Loading