Imported from https://github.com/alexggmatthews/GPflow_profiling