Actually i think i solved main question by doing this:
        encoded_y_query = []

        for classs in y_query.split(1):
            encoded_sents = []
            for sentence in classs.squeeze_().split(1):
                encoded_sents.append(self.cnn_encoder.forward(sentence.squeeze_()))
            encoded_y_query.append(encoded_sents)
        y_tensors = []
        for i in range(y_query.shape[0]):
            temp_tens = []
            for j in range(y_query.shape[1]):
                temp_tens.append(torch.tensor(encoded_y_query[i][j]))

            y_tensors.append(torch.cat(temp_tens))

        y_query = torch.cat(y_tensors)

This code does forward pass for each sentence in tensor [K,N, sentence_length].
Although it needs a little of fine tuning due to batch_size. But i’ll sure handle that.
But i still would want ti know if my cnn works as i want it to work (described in previous post).
I’d be readlly glad if you could help me with that.