added tensor folding