mask has shape [125]
dots has shape [100, 125]
First I want to multiply each element in column c in dots by mask[c]
Second I want to sum each column c of dots to end up with a tensor of shape [100]
for (int i = 0; i < 125; i += 1)
{
for (int j = 0; j < 100; j+= 1)
{
dots.index({j, i}) = dots.index({j, i}) * mask.index({i});
}
}
torch::Tensor final_add = torch::zeros({100}, torch::dtype(torch::kFloat64).requires_grad(false));
for (int i = 0; i < 125; i += 1)
{
for (int j = 0; j < 100; j += 1)
{
final_add.index({j}) = final_add.index({j}) + dots.index({j, i});
}
}