Move assignment of tf2 to data object to run function