"src/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "db7b7bd983e6e40f54570a9e36abb8491896e1c2"
Commit 926960ab authored by rusty1s's avatar rusty1s
Browse files

pytorch 1.0.0 update

parent f371e49e
...@@ -17,9 +17,9 @@ before_install: ...@@ -17,9 +17,9 @@ before_install:
- export CC="gcc-4.9" - export CC="gcc-4.9"
- export CXX="g++-4.9" - export CXX="g++-4.9"
install: install:
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp27-cp27mu-linux_x86_64.whl; fi - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp27-cp27mu-linux_x86_64.whl; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp35-cp35m-linux_x86_64.whl; fi - if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then pip install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp35-cp35m-linux_x86_64.whl; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-linux_x86_64.whl; fi - if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then pip install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl; fi
- pip install pycodestyle - pip install pycodestyle
- pip install flake8 - pip install flake8
- pip install codecov - pip install codecov
......
#include <torch/torch.h> #include <torch/extension.h>
#include "utils.h" #include "utils.h"
...@@ -8,7 +8,7 @@ at::Tensor graclus(at::Tensor row, at::Tensor col, int64_t num_nodes) { ...@@ -8,7 +8,7 @@ at::Tensor graclus(at::Tensor row, at::Tensor col, int64_t num_nodes) {
std::tie(row, col) = to_csr(row, col, num_nodes); std::tie(row, col) = to_csr(row, col, num_nodes);
auto row_data = row.data<int64_t>(), col_data = col.data<int64_t>(); auto row_data = row.data<int64_t>(), col_data = col.data<int64_t>();
auto perm = randperm(num_nodes); auto perm = at::randperm(num_nodes, row.options());
auto perm_data = perm.data<int64_t>(); auto perm_data = perm.data<int64_t>();
auto cluster = at::full(num_nodes, -1, row.options()); auto cluster = at::full(num_nodes, -1, row.options());
...@@ -43,7 +43,7 @@ at::Tensor weighted_graclus(at::Tensor row, at::Tensor col, at::Tensor weight, ...@@ -43,7 +43,7 @@ at::Tensor weighted_graclus(at::Tensor row, at::Tensor col, at::Tensor weight,
std::tie(row, col, weight) = to_csr(row, col, weight, num_nodes); std::tie(row, col, weight) = to_csr(row, col, weight, num_nodes);
auto row_data = row.data<int64_t>(), col_data = col.data<int64_t>(); auto row_data = row.data<int64_t>(), col_data = col.data<int64_t>();
auto perm = randperm(num_nodes); auto perm = at::randperm(num_nodes, row.options());
auto perm_data = perm.data<int64_t>(); auto perm_data = perm.data<int64_t>();
auto cluster = at::full(num_nodes, -1, row.options()); auto cluster = at::full(num_nodes, -1, row.options());
......
#include <torch/torch.h> #include <torch/extension.h>
at::Tensor grid(at::Tensor pos, at::Tensor size, at::Tensor start, at::Tensor grid(at::Tensor pos, at::Tensor size, at::Tensor start,
at::Tensor end) { at::Tensor end) {
......
#pragma once #pragma once
#include <torch/torch.h> #include <torch/extension.h>
std::tuple<at::Tensor, at::Tensor> remove_self_loops(at::Tensor row, std::tuple<at::Tensor, at::Tensor> remove_self_loops(at::Tensor row,
at::Tensor col) { at::Tensor col) {
...@@ -15,14 +15,8 @@ remove_self_loops(at::Tensor row, at::Tensor col, at::Tensor weight) { ...@@ -15,14 +15,8 @@ remove_self_loops(at::Tensor row, at::Tensor col, at::Tensor weight) {
weight.masked_select(mask)); weight.masked_select(mask));
} }
at::Tensor randperm(int64_t n) {
auto out = at::empty(n, torch::CPU(at::kLong));
at::randperm_out(out, n);
return out;
}
std::tuple<at::Tensor, at::Tensor> rand(at::Tensor row, at::Tensor col) { std::tuple<at::Tensor, at::Tensor> rand(at::Tensor row, at::Tensor col) {
auto perm = randperm(row.size(0)); auto perm = at::randperm(row.size(0), row.options());
return std::make_tuple(row.index_select(0, perm), col.index_select(0, perm)); return std::make_tuple(row.index_select(0, perm), col.index_select(0, perm));
} }
......
...@@ -21,7 +21,7 @@ if CUDA_HOME is not None: ...@@ -21,7 +21,7 @@ if CUDA_HOME is not None:
['cuda/radius.cpp', 'cuda/radius_kernel.cu']), ['cuda/radius.cpp', 'cuda/radius_kernel.cu']),
] ]
__version__ = '1.2.0' __version__ = '1.2.1'
url = 'https://github.com/rusty1s/pytorch_cluster' url = 'https://github.com/rusty1s/pytorch_cluster'
install_requires = [] install_requires = []
......
...@@ -5,7 +5,7 @@ from .nearest import nearest ...@@ -5,7 +5,7 @@ from .nearest import nearest
from .knn import knn, knn_graph from .knn import knn, knn_graph
from .radius import radius, radius_graph from .radius import radius, radius_graph
__version__ = '1.2.0' __version__ = '1.2.1'
__all__ = [ __all__ = [
'graclus_cluster', 'graclus_cluster',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment