Skip to content

Commit

Permalink
Update on "quant docs: add and clean up InstanceNorm{n}d"
Browse files Browse the repository at this point in the history
Fixes docstrings and adds to quantization docs for quantized InstanceNorm.

Test plan:
* build on Mac OS and inspect

Differential Revision: [D22152637](https://our.internmc.facebook.com/intern/diff/D22152637)

[ghstack-poisoned]
  • Loading branch information
vkuzo committed Jun 23, 2020
2 parents 6855ab6 + aea3438 commit b08d1f4
Show file tree
Hide file tree
Showing 81 changed files with 1,478 additions and 1,931 deletions.
3 changes: 0 additions & 3 deletions .circleci/cimodel/data/simple/docker_definitions.py
Expand Up @@ -5,16 +5,13 @@

# TODO: make this generated from a matrix rather than just a static list
IMAGE_NAMES = [
"pytorch-linux-bionic-cuda11.0-cudnn8-py3.6-gcc9",
"pytorch-linux-bionic-cuda11.0-cudnn8-py3.8-gcc9",
"pytorch-linux-bionic-cuda10.2-cudnn7-py3.8-gcc9",
"pytorch-linux-bionic-py3.6-clang9",
"pytorch-linux-bionic-cuda10.2-cudnn7-py3.6-clang9",
"pytorch-linux-bionic-py3.8-gcc9",
"pytorch-linux-xenial-cuda10-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda10.1-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda11.0-cudnn8-py3-gcc7",
"pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4",
"pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7",
"pytorch-linux-xenial-py3-clang5-android-ndk-r19c",
Expand Down
9 changes: 0 additions & 9 deletions .circleci/config.yml
Expand Up @@ -7946,12 +7946,6 @@ workflows:
only:
- master
jobs:
- docker_build_job:
name: "pytorch-linux-bionic-cuda11.0-cudnn8-py3.6-gcc9"
image_name: "pytorch-linux-bionic-cuda11.0-cudnn8-py3.6-gcc9"
- docker_build_job:
name: "pytorch-linux-bionic-cuda11.0-cudnn8-py3.8-gcc9"
image_name: "pytorch-linux-bionic-cuda11.0-cudnn8-py3.8-gcc9"
- docker_build_job:
name: "pytorch-linux-bionic-cuda10.2-cudnn7-py3.8-gcc9"
image_name: "pytorch-linux-bionic-cuda10.2-cudnn7-py3.8-gcc9"
Expand All @@ -7973,9 +7967,6 @@ workflows:
- docker_build_job:
name: "pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7"
- docker_build_job:
name: "pytorch-linux-xenial-cuda11.0-cudnn8-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda11.0-cudnn8-py3-gcc7"
- docker_build_job:
name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
Expand Down
33 changes: 0 additions & 33 deletions .circleci/docker/build.sh
Expand Up @@ -125,17 +125,6 @@ case "$image" in
VISION=yes
KATEX=yes
;;
pytorch-linux-xenial-cuda11.0-cudnn8-py3-gcc7)
UBUNTU_VERSION=16.04-rc
CUDA_VERSION=11.0
CUDNN_VERSION=8
ANACONDA_PYTHON_VERSION=3.6
GCC_VERSION=7
PROTOBUF=yes
DB=yes
VISION=yes
KATEX=yes
;;
pytorch-linux-xenial-py3-clang5-asan)
ANACONDA_PYTHON_VERSION=3.6
CLANG_VERSION=5.0
Expand Down Expand Up @@ -193,28 +182,6 @@ case "$image" in
DB=yes
VISION=yes
;;
pytorch-linux-bionic-cuda11.0-cudnn8-py3.6-gcc9)
UBUNTU_VERSION=18.04-rc
CUDA_VERSION=11.0
CUDNN_VERSION=8
ANACONDA_PYTHON_VERSION=3.6
GCC_VERSION=9
PROTOBUF=yes
DB=yes
VISION=yes
KATEX=yes
;;
pytorch-linux-bionic-cuda11.0-cudnn8-py3.8-gcc9)
UBUNTU_VERSION=18.04-rc
CUDA_VERSION=11.0
CUDNN_VERSION=8
ANACONDA_PYTHON_VERSION=3.8
GCC_VERSION=9
PROTOBUF=yes
DB=yes
VISION=yes
KATEX=yes
;;
pytorch-linux-xenial-rocm3.3-py3.6)
ANACONDA_PYTHON_VERSION=3.6
PROTOBUF=yes
Expand Down
17 changes: 9 additions & 8 deletions .circleci/docker/common/install_base.sh
Expand Up @@ -2,16 +2,17 @@

set -ex

# NVIDIA dockers for RC releases use tag names like `11.0-cudnn8-devel-ubuntu18.04-rc`,
# for this case we will set UBUNTU_VERSION to `18.04-rc` so that the Dockerfile could
# find the correct image. As a result, here we have to check for
# "$UBUNTU_VERSION" == "18.04"*
# instead of
# "$UBUNTU_VERSION" == "18.04"
if [[ "$UBUNTU_VERSION" == "18.04"* ]]; then
if [[ "$UBUNTU_VERSION" == "14.04" ]]; then
# cmake 2 is too old
cmake3=cmake3
else
cmake3=cmake
fi

if [[ "$UBUNTU_VERSION" == "18.04" ]]; then
cmake3="cmake=3.10*"
else
cmake3="cmake=3.5*"
cmake3="${cmake3}=3.5*"
fi

# Install common dependencies
Expand Down
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -353,8 +353,6 @@ We appreciate all contributions. If you are planning to contribute back bug-fixe
If you plan to contribute new features, utility functions or extensions to the core, please first open an issue and discuss the feature with us.
Sending a PR without discussion might end up resulting in a rejected PR, because we might be taking the core in a different direction than you might be aware of.

To learn more about making a contribution to Pytorch, please see our [Contribution page](CONTRIBUTING.md).

## The Team

PyTorch is a community driven project with several skillful engineers and researchers contributing to it.
Expand Down
14 changes: 1 addition & 13 deletions android/pytorch_android/build.gradle
Expand Up @@ -86,7 +86,7 @@ task sourcesJar(type: Jar) {

def getLibtorchHeadersDir() {
def abi = ABI_FILTERS.split(",")[0]
return "$rootDir/../build_android_$abi/install/include";
return "$rootDir/../build_android_$abi/include";
}

afterEvaluate {
Expand All @@ -106,18 +106,6 @@ afterEvaluate {
}
}

tasks.whenTaskAdded { task ->
if (task.name.startsWith("bundle") && task.name.endsWith("Aar")) {
task.doLast {
addFolderToAarTask(
"addHeadersTo" + task.name,
task.archivePath,
getLibtorchHeadersDir(),
"headers").execute()
}
}
}

def addFolderToAarTask(taskName, aarPath, folderPath, folderPathInAar) {
def tmpDir = file("${buildDir}/${taskName}")
tmpDir.mkdir()
Expand Down
41 changes: 35 additions & 6 deletions aten/src/ATen/Declarations.cwrap
Expand Up @@ -210,6 +210,36 @@
- bool largest
- bool sorted
]]
[[
name: _th_var
types:
- floating_point
backends:
- CPU
- CUDA
variants: function
options:
- cname: var_all
return: accreal
arguments:
- THTensor* self
- bool unbiased
]]
[[
name: _th_std
types:
- floating_point
backends:
- CPU
- CUDA
variants: function
options:
- cname: std_all
return: accreal
arguments:
- THTensor* self
- bool unbiased
]]
[[
name: _th_renorm
cname: renorm
Expand Down Expand Up @@ -345,10 +375,10 @@
name: _th_addmm
cname: addmm
cpu_bfloat16: True
cuda_bfloat16: True
variants:
- function
return: argument 0
backends: [CPU]
options:
- arguments:
- arg: THTensor* result
Expand All @@ -365,7 +395,6 @@
cuda_bfloat16: True
variants: [function]
return: self
backends: [CPU]
options:
- cname: addmm
arguments:
Expand All @@ -380,9 +409,9 @@
name: _th_addr
cname: addr
cpu_bfloat16: True
cuda_bfloat16: True
variants: function
return: argument 0
backends: [CPU]
arguments:
- arg: THTensor* result
output: True
Expand All @@ -395,10 +424,10 @@
[[
name: _th_addr_
cpu_bfloat16: True
cuda_bfloat16: True
cname: addr
return: self
variants: function
backends: [CPU]
arguments:
- THTensor* self
- THTensor* self
Expand Down Expand Up @@ -428,10 +457,10 @@
]]
[[
name: _th_addbmm
cuda_bfloat16: True
cname: addbmm
variants:
- function
backends: [CPU]
return: argument 0
arguments:
- arg: THTensor* result
Expand All @@ -444,10 +473,10 @@
]]
[[
name: _th_addbmm_
cuda_bfloat16: True
cname: addbmm
variants: function
return: self
backends: [CPU]
arguments:
- THTensor* self
- THTensor* self
Expand Down
15 changes: 0 additions & 15 deletions aten/src/ATen/NamedTensorUtils.cpp
Expand Up @@ -384,21 +384,6 @@ void propagate_names_for_addmv(
}

void propagate_names_for_addmm(
Tensor& result,
const Tensor& m1,
const Tensor& m2,
const Tensor& bias) {
if (!m1.has_names() && !m2.has_names() &&
!bias.has_names() && !result.has_names()) {
return;
}

auto mm_outnames = compute_matmul_outnames(m1.names(), m2.names());
auto add_outnames = unify_from_right(mm_outnames, bias.names());
propagate_names(result, add_outnames);
}

void propagate_names_for_addmm_legacy(
TensorImpl* result,
TensorImpl* m1,
TensorImpl* m2,
Expand Down
7 changes: 0 additions & 7 deletions aten/src/ATen/NamedTensorUtils.h
Expand Up @@ -141,13 +141,6 @@ CAFFE2_API void propagate_names(TensorImpl* result, /*const */TensorImpl* src);

// result = m1 @ m2 + bias
CAFFE2_API void propagate_names_for_addmm(
Tensor& result,
const Tensor& m1,
const Tensor& m2,
const Tensor& bias);

// result = m1 @ m2 + bias
CAFFE2_API void propagate_names_for_addmm_legacy(
TensorImpl* result,
/*const*/TensorImpl* m1,
/*const*/TensorImpl* m2,
Expand Down
2 changes: 2 additions & 0 deletions aten/src/ATen/core/NamedRegistrations.cpp
Expand Up @@ -18,6 +18,8 @@ TORCH_LIBRARY_IMPL(aten, Named, m) {
m.impl("_sparse_log_softmax.int", CppFunction::makeFallthrough());
m.impl("_sparse_softmax.Dimname", CppFunction::makeFallthrough());
m.impl("_sparse_softmax.int", CppFunction::makeFallthrough());
m.impl("_std", CppFunction::makeFallthrough());
m.impl("_var", CppFunction::makeFallthrough());
m.impl("abs", CppFunction::makeFallthrough());
m.impl("abs.out", CppFunction::makeFallthrough());
m.impl("abs_", CppFunction::makeFallthrough());
Expand Down
4 changes: 0 additions & 4 deletions aten/src/ATen/core/aten_interned_strings.h
Expand Up @@ -730,10 +730,6 @@ _(aten, where) \
_(aten, zero) \
_(aten, zeros) \
_(aten, zeros_like) \
_(aten, real) \
_(aten, imag) \
_(aten, view_as_real) \
_(aten, view_as_complex) \
/* nothing */

#define FORALL_ATTR_BASE_SYMBOLS(_) \
Expand Down
41 changes: 0 additions & 41 deletions aten/src/ATen/cuda/CUDABlas.cpp
Expand Up @@ -392,47 +392,6 @@ void gemv<at::BFloat16>(CUDABLAS_GEMV_ARGTYPES(at::BFloat16)) {
}
#endif

namespace {
template<typename scalar_t>
cublasStatus_t cublasGer(const cublasHandle_t &handle, int64_t m, int64_t n, scalar_t *alpha, scalar_t *x, int64_t incx, scalar_t *y, int64_t incy, scalar_t *a, int64_t lda) {
TORCH_CHECK(false, "cublas ger is defined only for float and double");
return {};
}
template<>
cublasStatus_t cublasGer<float>(const cublasHandle_t &handle, int64_t m, int64_t n, float *alpha, float *x, int64_t incx, float *y, int64_t incy, float *a, int64_t lda) {
return cublasSger(handle, m, n, alpha, x, incx, y, incy, a, lda);
}
template<>
cublasStatus_t cublasGer<double>(const cublasHandle_t &handle, int64_t m, int64_t n, double *alpha, double *x, int64_t incx, double *y, int64_t incy, double *a, int64_t lda) {
return cublasDger(handle, m, n, alpha, x, incx, y, incy, a, lda);
}
} // anonymous namespace

template<typename scalar_t>
void ger(int64_t m, int64_t n, scalar_t alpha, scalar_t *x, int64_t incx, scalar_t *y, int64_t incy, scalar_t *a, int64_t lda)
{
_cublasAdjustLdLevel2(m, n, &lda);
TORCH_CHECK((m <= INT_MAX) &&
(n <= INT_MAX) &&
(lda <= INT_MAX) &&
(incx <= INT_MAX) &&
(incy <= INT_MAX),
"cublasSger/cublasDger only supports m, n, lda, incx, incy with "
"the bound [val] <= %d", INT_MAX);
int i_m = (int)m;
int i_n = (int)n;
int i_lda = (int)lda;
int i_incx = (int)incx;
int i_incy = (int)incy;

cublasHandle_t handle = at::cuda::getCurrentCUDABlasHandle();
TORCH_CUDABLAS_CHECK(cublasGer<scalar_t>(
handle, i_m, i_n, &alpha, x, i_incx, y, i_incy, a, i_lda));
}
template void ger<float>(int64_t m, int64_t n, float alpha, float *x, int64_t incx, float *y, int64_t incy, float *a, int64_t lda);
template void ger<double>(int64_t m, int64_t n, double alpha, double *x, int64_t incx, double *y, int64_t incy, double *a, int64_t lda);


} // namespace blas
} // namespace cuda
} // namespace at
3 changes: 0 additions & 3 deletions aten/src/ATen/cuda/CUDABlas.h
Expand Up @@ -69,9 +69,6 @@ template <>
void gemv<at::BFloat16>(CUDABLAS_GEMV_ARGTYPES(at::BFloat16));
#endif

template<typename Dtype>
void ger(int64_t m, int64_t n, Dtype alpha, Dtype *x, int64_t incx, Dtype *y, int64_t incy, Dtype *a, int64_t lda);

} // namespace blas
} // namespace cuda
} // namespace at

0 comments on commit b08d1f4

Please sign in to comment.