Increment memorySize dynamically in serverless.yml

Due to unexplained reasons, we’ve discovered that our deployments work really well when we switch between 2 sets of memorySize values for each deployment.

Is it possible to read the current value for memorySize and then add or subtract a few gigs to it dynamically in serverless.yml?