ex6: deep network for digit classification