Pytorch tensor operations

This post covers some of the key operations used in pytorch

argmax

Returns the indices of the maximum value of all elements in the input tensor.

This is the second value returned by torch.max()

a = torch.randn(4, 3)
a
>>
tensor([[ 2.0149, 1.0420, -1.3816]…

Numpy Axes

This post covers a quick overview of axes in numpy (NB both numpy and pytorch use same representation)

import numpy as np

Axes

2D matrices

For both numpy and pytorch, axis 0 = row, 1 = column

Note how when we specify axis=0 for sum, we are collapsing along that (row) axis

np.sum([[1…

SuperMicro IPMI when a board wont post

I bought a used Supermicro X9DRi-LN4F+ from ebay to use for datascience projects involving large datasets where having >128MB RAM and 20+ cpu cores would speed up data processing. …

Batch Norm and Transfer Learning — whats going on?

A commonly used technique in deep-learning is transfer-learning, whereby the learned weights of a model that was pre-trained on one dataset are used to ‘bootstrap’ training of early or all but the the final layer of a modified version of the model applied to a different dataset.

This technique allows…

Watercooling a Deep Learning Machine

This is an article documenting the lessons I have learnt building two watercooled deep learning boxes. There are plenty of youtube videos and articles about watercooling gaming rigs, there is much less information about multi-GPU water-cooling setups.

If you research what type of GPU’s to use for multi-GPU deep learning…

Pandas for time series data — tricks and tips

There are some Pandas DataFrame manipulations that I keep looking up how to do. I am recording these here to save myself time. These may help you too.

Time series data

Convert column to datetime with given format

df[‘day_time’] = pd.to_datetime(df[‘day_time’], format=’%Y-%m-%d %H:%M:%S’)0 2012–10–12 00:00:00
1 2012–10–12 00:30:00
2 2012–10–12 01:00:00
3 2012–10–12 01:30:00… 