Dynamic memory to alleviate catastrophic forgetting in continuous learning settings