This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def conv_forward_naive(x, w, b, conv_param): | |
""" | |
A naive implementation of the forward pass for a convolutional layer. | |
The input consists of N data points, each with C channels, height H and | |
width W. We convolve each input with F different filters, where each filter | |
spans all C channels and has height HH and width WW. | |
Input: | |
- x: Input data of shape (N, C, H, W) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def conv_backward_naive(dout, cache): | |
""" | |
A naive implementation of the backward pass for a convolutional layer. | |
Inputs: | |
- dout: Upstream derivatives. | |
- cache: A tuple of (x, w, b, conv_param) as in conv_forward_naive | |
Returns a tuple of: | |
- dx: Gradient with respect to x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cudnn.h> | |
#include <cassert> | |
#include <cstdlib> | |
#include <iostream> | |
#include <opencv2/opencv.hpp> | |
#define checkCUDNN(expression) \ | |
{ \ | |
cudnnStatus_t status = (expression); \ | |
if (status != CUDNN_STATUS_SUCCESS) { \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Outputs some information on CUDA-enabled devices on your computer, | |
including current memory usage. | |
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1 | |
from C to Python with ctypes, so it can run without compiling anything. Note | |
that this is a direct translation with no attempt to make the code Pythonic. |