[[[1]]]

Dimensions are becoming the bane of my life. Take the title to this post. The value is the number 1, but what all those brackets mean is this. Imagine you have an MS Excel workbook (or whatever spreadsheet app you use). This workbook has the possibility of several worksheets. Each worksheet has a number of rows, and each row a number of columns. The above notation means the value 1 in the first column of the first row of the first worksheet in the workbook. I’m pretty sure this makes it a 3 dimensional value.

Some of the issues I’m having converting code to work with different data are related to this issue of dimensions. The result of

torch.tensor([1, 2, 3])

is not the same as

torch.tensor([[1, 2, 3]])

That extra set of brackets creates an extra dimension, even though the values are the same. Problem is functions expect input data to be in a certain format and spit the dummy throw Exceptions if the format isn’t what they expect. Only by carefully stepping through the code, while it’s running, with the debugger allows me to see what types and dimensions data has. I’m still pretty new to PyTorch (and tensors generally) so it might take a while to get up to speed on this.