Hi,
I really like the library so far. However, I was wondering if broadcasting is on the roadmap, and what would be your current suggestion for work-arounds?
For a toy example, say I want to train OLS linear regression model and want to compute the net input from a 2D dataset (w_1 * x_1 + w_2 * x_2 + bias) with 6 training instances (just to have a toy example for illustrative purposes) . The following wouldn’t work) since there’s no broadcasting when the bias is added (x.mm(weights) + bias)
x = Variable(torch.Tensor([[1.0, 1.0],
[2.0, 2.0],
[3.0, 3.0],
[4.0, 4.0],
[5.0, 5.0],
[6.0, 6.0]]))
weights = Variable(torch.zeros(2, 1))
bias = Variable(torch.zeros(1))
net_input = x.mm(weights) + bias
A workaround would be to add 1s to the input tensor, I guess:
x = Variable(torch.Tensor([[1.0, 1.0, 1.0],
[1.0, 2.0, 2.0],
[1.0, 3.0, 3.0],
[1.0, 4.0, 4.0],
[1.0, 5.0, 5.0],
[1.0, 6.0, 6.0]]))
weights = Variable(torch.zeros(3, 1))
net_input = x.mm(weights)
What would be your thoughts on that?