Why not just model.SampleValue instead of float32? Then you can also get rid of the casts in the callsites.