The error is raised, since s_output and real_target have a different shape, which is not supported.
I don’t know how the output is calculated or what the used batch size is supposed to be, so you would have to check where this size difference is coming from and what the expected shape would be.
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier.