Changed the output of encode_fn to self.output in SdA.build_encode_functions