Skip to content

Merge from upstream #99

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 28 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f51f15b
Update include paths for ATen/core (#10130)
smessmer Aug 3, 2018
65d32b1
Remove unused substitutions (#10187)
smessmer Aug 3, 2018
6456b94
ctc_loss odds and ends (#10112)
t-vi Aug 3, 2018
97cbcb7
Allow releasing/retaining weak_intrusive_ptr (#10214)
smessmer Aug 3, 2018
4680ab4
Generalize intrusive_ptr comment (#10216)
smessmer Aug 3, 2018
c5abe88
Add IDEEP fallbacks for Resnet50 training ops (#8541)
wuhuikx Aug 3, 2018
08e7af2
Implement calling of c10 ops from c2 (#9369)
smessmer Aug 3, 2018
4aa7469
Implement c10 ops needed for benchmark (#9360)
smessmer Aug 3, 2018
3b3aff2
IsType<TensorCPU> -> IsType<Tensor>(CPU) (#10135)
jerryzh168 Aug 4, 2018
7bc8717
Kill Tensor::shares_data (#10217)
Aug 4, 2018
149d4f7
use logsigmoid at multilabel_soft_margin_loss, and change output from…
weiyangfb Aug 4, 2018
41dce17
Delete TensorImpl::type_, replace with backend_/scalar_type_/is_varia…
ezyang Aug 4, 2018
02a64b1
Move ATenGeneral back out of core. (#10224)
ezyang Aug 4, 2018
c7c6e93
Use target_compile_definitions for AT_CORE_STATIC_WINDOWS (#10213)
ezyang Aug 4, 2018
e2976ea
Make at::Error look more like caffe2::EnforceNotMet (#10183)
ezyang Aug 4, 2018
98d60ad
Replace caffe2::EnforceNotMet with at::Error
ezyang Aug 4, 2018
3693941
Introduce at::DeviceType, which subsumes at::Device::Type and (partia…
ezyang Aug 4, 2018
5df8547
Fix ONNX LogSoftmax export. (#9576)
kit1980 Aug 4, 2018
2141cb7
Update OnnxifiOp to reflect onnx/onnx#1256
Aug 4, 2018
29406a2
Fix shared_ptr refcycle in graph executor (#10222)
zou3519 Aug 4, 2018
57d2d4b
Optimize reduce ops for 2d and 3d (#9992)
xiaomengy Aug 4, 2018
ab29392
support generic feature in DPER2 (#10197)
huginhuangfb Aug 4, 2018
f57e4ce
Update broadcast with alpha to reduce num of launching kernels. (#10235)
xiaomengy Aug 5, 2018
df23bdc
add BEGIN NOT-CLEAN-FILES marker to .gitignore. (#10233)
shkit Aug 5, 2018
7f2e43a
Add the ocr_rec model json (#10240)
lly-zero-one Aug 5, 2018
267c397
Add the ocr_det model for benchmarking (#10245)
lly-zero-one Aug 5, 2018
506142a
Add warning for building PyTorch using Python 2.7 on Windows (#10247)
peterjc123 Aug 6, 2018
091d9b9
Merge remote-tracking branch 'upstream/master'
iotamudelta Aug 6, 2018
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
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ docs/source/scripts/activation_images/
# PyCharm files
.idea

# Visual Studio Code files
.vscode
.vs

# OSX dir files
.DS_Store

Expand Down Expand Up @@ -195,3 +191,11 @@ caffe2.egg-info

# Atom/Watchman required file
.watchmanconfig

# BEGIN NOT-CLEAN-FILES (setup.py handles this marker. Do not change.)
#
# Below files are not deleted by "setup.py clean".

# Visual Studio Code files
.vscode
.vs
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ If you want to compile with CUDA support, install
If you want to disable CUDA support, export environment variable `NO_CUDA=1`.
Other potentially useful environment variables may be found in `setup.py`.

If you want to build on Windows, Visual Studio 2017 and NVTX are also needed.
If you want to build on Windows, Visual Studio 2017 14.11 toolset and NVTX are also needed.
Especially, for CUDA 8 build on Windows, there will be an additional requirement for VS 2015 Update 3 and a patch for it.
The details of the patch can be found out [here](https://support.microsoft.com/en-gb/help/4020481/fix-link-exe-crashes-with-a-fatal-lnk1000-error-when-you-use-wholearch).

#### Install optional dependencies

Expand Down Expand Up @@ -196,9 +198,10 @@ On Windows
set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build"
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
set DISTUTILS_USE_SDK=1
REM The following line is needed for Python 2.7, but the support for it is very experimental.
REM The following two lines are needed for Python 2.7, but the support for it is very experimental.
set MSSdk=1
REM As for CUDA 8, VS2015 Update 2 or up is required to build PyTorch. Use the following two lines.
set FORCE_PY27_BUILD=1
REM As for CUDA 8, VS2015 Update 3 is also required to build PyTorch. Use the following two lines.
set "PREBUILD_COMMAND=%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat"
set PREBUILD_COMMAND_ARGS=x64

Expand Down
10 changes: 5 additions & 5 deletions aten/doc/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include <functional>

#include "ATen/ATenGeneral.h"
#include "ATen/ArrayRef.h"
#include "ATen/Allocator.h"
#include "ATen/Generator.h"
#include "ATen/Half.h"
#include "ATen/SparseTensorRef.h"
#include "ATen/ScalarType.h"
#include "ATen/Scalar.h"
#include "ATen/ScalarType.h"
#include "ATen/SparseTensorRef.h"
#include "ATen/Tensor.h"
#include "ATen/Allocator.h"
#include "ATen/core/ArrayRef.h"
#include "ATen/core/Half.h"

// To solve the conflict of s_addr in inaddr.h
#ifdef _MSC_VER
Expand Down
30 changes: 15 additions & 15 deletions aten/src/ATen/ATen.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#pragma once

#include "ATen/ATenGeneral.h"
#include "ATen/CPUGeneral.h"
#include "ATen/Allocator.h"
#include "ATen/Scalar.h"
#include "ATen/Type.h"
#include "ATen/Generator.h"
#include "ATen/CPUGeneral.h"
#include "ATen/CUDAGuard.h"
#include "ATen/Context.h"
#include "ATen/Device.h"
#include "ATen/DeviceGuard.h"
#include "ATen/DimVector.h"
#include "ATen/Dispatch.h"
#include "ATen/Formatting.h"
#include "ATen/Functions.h"
#include "ATen/Generator.h"
#include "ATen/Layout.h"
#include "ATen/OptionsGuard.h"
#include "ATen/Scalar.h"
#include "ATen/Storage.h"
#include "ATen/Tensor.h"
#include "ATen/Device.h"
#include "ATen/TensorGeometry.h"
#include "ATen/Functions.h"
#include "ATen/Formatting.h"
#include "ATen/TensorOperators.h"
#include "ATen/TensorMethods.h"
#include "ATen/Dispatch.h"
#include "ATen/DimVector.h"
#include "ATen/DeviceGuard.h"
#include "ATen/TensorOperators.h"
#include "ATen/TensorOptions.h"
#include "ATen/Layout.h"
#include "ATen/OptionsGuard.h"
#include "ATen/CUDAGuard.h"
#include "ATen/Error.h"
#include "ATen/Type.h"
#include "ATen/core/Error.h"
1 change: 1 addition & 0 deletions aten/src/ATen/ATenGeneral.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <ATen/ATenGeneral.h>
2 changes: 1 addition & 1 deletion aten/src/ATen/AccumulateType.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "ATen/Config.h"
#include "ATen/Half.h"
#include "ATen/core/Half.h"

// Defines the accumulation type for a scalar type.
// Example:
Expand Down
4 changes: 2 additions & 2 deletions aten/src/ATen/Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <memory>
#include <stddef.h>

#include <ATen/Error.h>
#include <ATen/Retainable.h>
#include <ATen/Device.h>
#include <ATen/Retainable.h>
#include <ATen/core/Error.h>
#include <ATen/core/UniqueVoidPtr.h>

namespace at {
Expand Down
1 change: 0 additions & 1 deletion aten/src/ATen/ArrayRef.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion aten/src/ATen/CPUFixedAllocator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "ATen/core/Error.h"
#include "TH/TH.h"
#include "ATen/Error.h"

// This file creates a fake allocator that just throws exceptions if
// it is actually used.
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/CheckGenerator.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "ATen/Error.h"
#include "ATen/Generator.h"
#include "ATen/Utils.h"
#include "ATen/core/Error.h"

namespace at {

Expand Down
2 changes: 2 additions & 0 deletions aten/src/ATen/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Context::Context()
Type::registerCPU(this);
}

// TODO: This could be bad juju if someone calls globalContext() in the
// destructor of an object with static lifetime.
Context & globalContext() {
static Context globalContext_;
return globalContext_;
Expand Down
6 changes: 3 additions & 3 deletions aten/src/ATen/Context.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

#include "ATen/ATenGeneral.h"
#include <ATen/CPUGeneral.h>
#include "ATen/ATenGeneral.h"
#include "ATen/CUDAStream.h"
#include "ATen/Generator.h"
#include "ATen/Type.h"
#include "ATen/Utils.h"
#include "ATen/Error.h"
#include "ATen/core/Error.h"
#include "ATen/detail/CUDAHooksInterface.h"
#include "ATen/CUDAStream.h"

// This is temporary
#include "ATen/core/ATenCoreTest.h"
Expand Down
16 changes: 1 addition & 15 deletions aten/src/ATen/Device.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ATen/Device.h>

#include <ATen/Error.h>
#include <ATen/core/Error.h>

#include <exception>
#include <ostream>
Expand Down Expand Up @@ -77,20 +77,6 @@ Device::Device(const std::string& device_string) : Device(Type::CPU) {

} // namespace at

std::ostream& operator<<(std::ostream& stream, at::Device::Type type) {
switch (type) {
case at::Device::Type::CPU: {
stream << "cpu";
break;
}
case at::Device::Type::CUDA: {
stream << "cuda";
break;
}
}
return stream;
}

std::ostream& operator<<(std::ostream& stream, const at::Device& device) {
stream << device.type();
if (device.has_index()) {
Expand Down
29 changes: 14 additions & 15 deletions aten/src/ATen/Device.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include <ATen/Error.h>
#include <ATen/ScalarType.h>
#include <ATen/core/Error.h>
#include <ATen/core/DeviceType.h>

#include <cstddef>
#include <iosfwd>
Expand All @@ -20,26 +21,25 @@ namespace at {
/// represents a specific, concrete device,
/// 2. When the device type is CPU, the device index must be zero.
struct Device {
/// The possible values of the device *type*.
enum class Type { CPU, CUDA };
using Type = at::DeviceType;

/// Converts a `Backend` to a `Device::Type` if possible.
static Type backend_to_type(Backend backend) {
/// Converts a `Backend` to a `DeviceType` if possible.
static DeviceType backend_to_type(Backend backend) {
switch (backend) {
case kCPU:
case kSparseCPU:
return Type::CPU;
return DeviceType::CPU;
case kCUDA:
case kSparseCUDA:
return Type::CUDA;
return DeviceType::CUDA;
default:
AT_ERROR(
"Invalid backend ", toString(backend), " for Device construction");
}
}

/// Constructs a new `Device` from a `Type` and an optional device index.
/* implicit */ Device(Type type, int32_t index = -1)
/// Constructs a new `Device` from a `DeviceType` and an optional device index.
/* implicit */ Device(DeviceType type, int32_t index = -1)
: type_(type), index_(index) {
AT_CHECK(
index == -1 || index >= 0,
Expand All @@ -59,7 +59,7 @@ struct Device {
/* implicit */ Device(const std::string& device_string);

/// Constructs a new `Device` from a `Backend` (which is converted to a
/// `Type`, if possible) and an optional device index.
/// `DeviceType`, if possible) and an optional device index.
/* implicit */ Device(Backend backend, int32_t index = -1)
: Device(backend_to_type(backend), index) {}

Expand All @@ -81,7 +81,7 @@ struct Device {
}

/// Returns the type of device this is.
Type type() const noexcept {
DeviceType type() const noexcept {
return type_;
}

Expand All @@ -97,21 +97,20 @@ struct Device {

/// Return true if the device is of CUDA type.
bool is_cuda() const noexcept {
return type_ == Type::CUDA;
return type_ == DeviceType::CUDA;
}

/// Return true if the device is of CPU type.
bool is_cpu() const noexcept {
return type_ == Type::CPU;
return type_ == DeviceType::CPU;
}

private:
Type type_;
DeviceType type_;
int32_t index_ = -1;
};
} // namespace at

AT_API std::ostream& operator<<(std::ostream& stream, at::Device::Type type);
AT_API std::ostream& operator<<(std::ostream& stream, const at::Device& device);

namespace std {
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/DeviceGuard.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <ATen/Device.h>
#include <ATen/Error.h>
#include <ATen/ScalarType.h>
#include <ATen/Tensor.h>
#include <ATen/core/Error.h>
#include <ATen/detail/CUDAHooksInterface.h>

#include <cstddef>
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/DimVector.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "SmallVector.h"
#include <ATen/core/SmallVector.h>
#include <stdint.h>

namespace at {
Expand Down
4 changes: 2 additions & 2 deletions aten/src/ATen/Dispatch.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <ATen/Error.h>
#include <ATen/Half.h>
#include <ATen/Type.h>
#include <ATen/core/Error.h>
#include <ATen/core/Half.h>

#define AT_PRIVATE_CASE_TYPE(enum_type, type, ...) \
case enum_type: { \
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/ExpandUtils.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "ATen/Tensor.h"
#include "ATen/Error.h"
#include "ATen/core/Error.h"

#include <functional>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/Layout.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <ATen/ScalarType.h>
#include <ATen/Error.h>
#include <ATen/core/Error.h>

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/MatrixRef.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <ATen/ArrayRef.h>
#include <ATen/Utils.h>
#include <ATen/core/ArrayRef.h>

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/OptionsGuard.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <ATen/OptionsGuard.h>
#include <ATen/optional.h>
#include <ATen/core/optional.h>

namespace at {

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/OptionsGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ATen/Layout.h>
#include <ATen/ScalarType.h>
#include <ATen/TensorOptions.h>
#include <ATen/optional.h>
#include <ATen/core/optional.h>

namespace at {

Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/Registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <string>
#include <vector>

#include <ATen/Backtrace.h>
#include <ATen/ATenGeneral.h>
#include <ATen/core/Backtrace.h>

namespace at {

Expand Down
3 changes: 1 addition & 2 deletions aten/src/ATen/Scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#include <utility>

#include "ATen/ATenGeneral.h"
#include "ATen/Half.h"
#include "ATen/ScalarType.h"
#include "ATen/TensorBase.h"

#include "ATen/core/Half.h"

namespace at {

Expand Down
4 changes: 2 additions & 2 deletions aten/src/ATen/ScalarType.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "ATen/ArrayRef.h"
#include "ATen/ATenGeneral.h"
#include "ATen/Half.h"
#include "ATen/core/ArrayRef.h"
#include "ATen/core/Half.h"

#include <cstdint>
#include <iostream>
Expand Down
Loading