I am Charmie

メモとログ

2018-04-01から1ヶ月間の記事一覧

PyTorch: at evaluation/test phase

I got a runtime error at evaluation phase of my simple siamese network as RuntimeError: cuda runtime error (2) : out of memory at the line of executing forward pass. Some comments on stackoverflow suggests to define x and y with volatile=T…

Spyder: QOpenGL related error

See spyder's issue. For my case, installing PyOpenGL fixed the error as conda install pyopengl

PyTorch: AutoGrad

See this tutorial. Set requires_grad=True for all tensors we compute gradients w.r.t. them. [code lang='python'] input and output x = torch.randn(N, D_in, device=device, dtype=dtype) y = torch.randn(N, D_out, device=device, dtype=dtype) pa…

PyTorch: define a neural network

See the tutorial. It's quite simple (Keras provides simpler interface though). A neural network is defined as a class that has a forward function. The forward function defines how input data is processed through the network. PyTorch automa…

PyTorch: installation

Super easy installation GUI on the web as below

Keras: a callback function to save loss on each batch

Inspired by this stackoverflow answer and keras.callbacks.CSVLogger, I implemented a callback function to save loss on each batch. [code lang='python'] class LossHistory(Callback): def __init__(self, filename, separator=',', append=False):…

Leap Motion SDK installation on Ubuntu 16.04

If Leap Motion SDK installation failed with dpkg command, the site gives you the answer. Before running sudo dpkg --install Leap-*-x64.deb, we should first make a file /lib/systemd/system/leapd.service with the following contents. Otherwis…