Skip to content
Permalink
Browse files

Add pytorch 1.3 support (#639)

  • Loading branch information...
ethanwharris authored and MattPainter01 committed Oct 11, 2019
1 parent 4330007 commit 81731eb1f4cb24f095a85355176f5071af0346dd
Showing with 16 additions and 5 deletions.
  1. +10 −0 .travis.yml
  2. +1 −0 CHANGELOG.md
  3. +1 −1 README.md
  4. +4 −4 torchbearer/callbacks/cutout.py
@@ -7,18 +7,24 @@ matrix:
env: TORCH_VERSION=1.1.0 TORCH_URL=http://download.pytorch.org/whl/cpu/torch-1.1.0-cp27-cp27mu-linux_x86_64.whl TORCHVISION=https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp27-cp27mu-linux_x86_64.whl
- python: "2.7"
env: TORCH_VERSION=1.2.0 TORCH_URL="torch==1.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "2.7"
env: TORCH_VERSION=1.3.0 TORCH_URL="torch==1.3.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.5"
env: TORCH_VERSION=1.0.0 TORCH_URL=http://download.pytorch.org/whl/cpu/torch-1.0.0-cp35-cp35m-linux_x86_64.whl TORCHVISION=torchvision==0.2.2.post3
- python: "3.5"
env: TORCH_VERSION=1.1.0 TORCH_URL=http://download.pytorch.org/whl/cpu/torch-1.1.0-cp35-cp35m-linux_x86_64.whl TORCHVISION=https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp35-cp35m-linux_x86_64.whl
- python: "3.5"
env: TORCH_VERSION=1.2.0 TORCH_URL="torch==1.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.5"
env: TORCH_VERSION=1.3.0 TORCH_URL="torch==1.3.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.6"
env: TORCH_VERSION=1.0.0 TORCH_URL=http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl TORCHVISION=torchvision==0.2.2.post3
- python: "3.6"
env: TORCH_VERSION=1.1.0 TORCH_URL=http://download.pytorch.org/whl/cpu/torch-1.1.0-cp36-cp36m-linux_x86_64.whl TORCHVISION=https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp36-cp36m-linux_x86_64.whl
- python: "3.6"
env: TORCH_VERSION=1.2.0 TORCH_URL="torch==1.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.6"
env: TORCH_VERSION=1.3.0 TORCH_URL="torch==1.3.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.7"
dist: xenial
sudo: true
@@ -31,6 +37,10 @@ matrix:
dist: xenial
sudo: true
env: TORCH_VERSION=1.2.0 TORCH_URL="torch==1.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html"
- python: "3.7"
dist: xenial
sudo: true
env: TORCH_VERSION=1.3.0 TORCH_URL="torch==1.3.0+cpu -f https://download.pytorch.org/whl/torch_stable.html" TORCHVISION="torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html"
before_install:
- echo $TRAVIS_COMMIT_RANGE

@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Added
- Added BCPlus callback for between-class learning
- Added support for PyTorch 1.3
### Changed
### Deprecated
### Removed
@@ -1,6 +1,6 @@
<img alt="logo" src="https://raw.githubusercontent.com/pytorchbearer/torchbearer/master/docs/_static/img/logo_dark_text.svg?sanitize=true" width="100%"/>
[![PyPI version](https://badge.fury.io/py/torchbearer.svg)](https://badge.fury.io/py/torchbearer) [![Python 2.7 | 3.5 | 3.6 | 3.7](https://img.shields.io/badge/python-2.7%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg)](https://www.python.org/) [![PyTorch 1.0.0 | 1.1.0 | 1.2.0](https://img.shields.io/badge/pytorch-1.0.0%20%7C%201.1.0%20%7C%201.2.0-brightgreen.svg)](https://pytorch.org/) [![Build Status](https://travis-ci.com/pytorchbearer/torchbearer.svg?branch=master)](https://travis-ci.com/pytorchbearer/torchbearer) [![codecov](https://codecov.io/gh/pytorchbearer/torchbearer/branch/master/graph/badge.svg)](https://codecov.io/gh/pytorchbearer/torchbearer) [![Documentation Status](https://readthedocs.org/projects/torchbearer/badge/?version=latest)](https://torchbearer.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/torchbearer)](https://pepy.tech/project/torchbearer)
[![PyPI version](https://badge.fury.io/py/torchbearer.svg)](https://badge.fury.io/py/torchbearer) [![Python 2.7 | 3.5 | 3.6 | 3.7](https://img.shields.io/badge/python-2.7%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg)](https://www.python.org/) [![PyTorch 1.0.0 | 1.1.0 | 1.2.0 | 1.3.0](https://img.shields.io/badge/pytorch-1.0.0%20%7C%201.1.0%20%7C%201.2.0%20%7C%201.3.0-brightgreen.svg)](https://pytorch.org/) [![Build Status](https://travis-ci.com/pytorchbearer/torchbearer.svg?branch=master)](https://travis-ci.com/pytorchbearer/torchbearer) [![codecov](https://codecov.io/gh/pytorchbearer/torchbearer/branch/master/graph/badge.svg)](https://codecov.io/gh/pytorchbearer/torchbearer) [![Documentation Status](https://readthedocs.org/projects/torchbearer/badge/?version=latest)](https://torchbearer.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/torchbearer)](https://pepy.tech/project/torchbearer)
<p align="center">
<a href="http://pytorchbearer.org">Website</a> •
@@ -192,10 +192,10 @@ def __call__(self, img):
y = torch.randint(h, (b,)).long()
x = torch.randint(w, (b,)).long()

y1 = (y - self.height // 2).clamp(0, h)
y2 = (y + self.height // 2).clamp(0, h)
x1 = (x - self.width // 2).clamp(0, w)
x2 = (x + self.width // 2).clamp(0, w)
y1 = (y - self.height // 2).clamp(0, h).int()
y2 = (y + self.height // 2).clamp(0, h).int()
x1 = (x - self.width // 2).clamp(0, w).int()
x2 = (x + self.width // 2).clamp(0, w).int()

for batch in range(b):
mask[batch, y1[batch]: y2[batch], x1[batch]: x2[batch]] = 0

0 comments on commit 81731eb

Please sign in to comment.
You can’t perform that action at this time.