Fixed the capsule / cobject memory destructor. Added types to deal with lists of arrays and lists of tensors as input and inplace types.