Could you post the shapes of all necessary tensors in order to create an executable code snippet, please?
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier