def initialize_encode_cache(self, example):
    """Initialize fields (performance caches) that point to example's state."""
    self._cast_fn = _make_cast_fn(self._np_dtype)
    self._value = self._value_fn(example.features.feature[self._name])
Initialize fields (performance caches) that point to example's state.
tensorflow_transform/coders/example_proto_coder.py