Author : Dua Guillaume
Date : 04-26-2020
Requirement : A first experience with CMake
As a modern C++ specialist, my job is to focus on software development, from a performance and quality perspective.
| #!/bin/bash | |
| ### steps #### | |
| # Verify the system has a cuda-capable gpu | |
| # Download and install the nvidia cuda toolkit and cudnn | |
| # Setup environmental variables | |
| # Verify the installation | |
| ### | |
| ### to verify your gpu is cuda enable check |
Here's a simple implementation of bilinear interpolation on tensors using PyTorch.
I wrote this up since I ended up learning a lot about options for interpolation in both the numpy and PyTorch ecosystems. More generally than just interpolation, too, it's also a nice case study in how PyTorch magically can put very numpy-like code on the GPU (and by the way, do autodiff for you too).
For interpolation in PyTorch, this open issue calls for more interpolation features. There is now a nn.functional.grid_sample() feature but at least at first this didn't look like what I needed (but we'll come back to this later).
In particular I wanted to take an image, W x H x C, and sample it many times at different random locations. Note also that this is different than upsampling which exhaustively samples and also doesn't give us fle
For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.
After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft
| import torch | |
| import torch.nn as nn | |
| import numpy as np | |
| import torch.optim as optim | |
| from torch.autograd import Variable | |
| # (1, 0) => target labels 0+2 | |
| # (0, 1) => target labels 1 | |
| # (1, 1) => target labels 3 | |
| train = [] |
| import numpy as np | |
| import scipy | |
| import scipy.ndimage | |
| from scipy.ndimage.filters import gaussian_filter | |
| from scipy.ndimage.interpolation import map_coordinates | |
| import collections | |
| from PIL import Image | |
| import numbers | |
| __author__ = "Wei OUYANG" |
| import torch | |
| from torch import nn | |
| __all__ = ['FCDenseNet', 'fcdensenet_tiny', 'fcdensenet56_nodrop', | |
| 'fcdensenet56', 'fcdensenet67', 'fcdensenet103', | |
| 'fcdensenet103_nodrop'] | |
| class DenseBlock(nn.Module): |
| #include <vector> | |
| #include <sstream> | |
| #include <iostream> | |
| #include <iterator> | |
| #include <tuple> | |
| template <typename T> | |
| std::vector<std::string> Split(T&& input) { | |
| std::stringstream ss{ std::forward<T>(input) }; | |
| return std::vector<std::string> {std::istream_iterator<std::string>(ss), std::istream_iterator<std::string>{} }; |