Add single element vector test to gradient code