change to one W
add d_costTreeFlat
test W param only
grad for costTree