Solved by Matej_Kompanek in post #6 
              
              
                I tried rewriting it with raw arrays (without really knowing what sizes of tensors you are using), seems much faster 
std::vector<at::Tensor> lltm_forward2(torch::Tensor dummy, torch::Tensor mult1, int element_per_filter, int mult1_shape_0, int y_index_2, int mult1_shape_1)
{
	TORCH_CHECK(dummy.is_c…