Text this: Theta function identities from optical neural network transformations