struggling to allocate gpu memory for arrays inside Chain object