Learning Task Models for Robotic Manipulation of Nonrigid Objects