Cumulative product of elements along dimension dim. If dim is omitted, it defaults to 1 (column-wise cumulative products).