Imported from https://github.com/sdoria/SimpleSelfAttention