The goal (says the comment, correctly) is one mean per FEATURE — averaging down the batch axis. But the code iterates rows, producing one mean per SAMPLE: three numbers where there should be two. This is the dim=0/dim=1 mixup in list form. Fix it to average each column.
The break is on line 4 — but read the whole snippet first.