Is it possible to add gradient of an image to a patch

I have an image gradient with size (224, 224) and a patch of (1, 768).

Both of them are not of the same size. Is it possible to add the image gradient to the patch and get an output of the patch i.e (1, 768)?

It would be possible to add both tensors after you’ve matched the size of them.
E.g. you could reduce the image gradient to get 768 values before applying the elementwise addition.

Yes. Thank you, I’ve done that already. I just want to know if it’ll be possible to embed the whole gradient of the image in just one patch.

I don’t understand the question completely. Could you post an example how the gradient would be “embedded” into the patch?

the end product would be the same patch on the left with the gradient of an entire image on the right added to it. My understanding is that it’s not possible, but knowledge isn’t bounded.

So, I figured out to do it myself. I divided the image gradient (right) into 16 x 16 patches, created a loop that adds each patch to the original image patch (left). This way, I was able to add a 224 x 224 image gradient into a 16 x 16 patch. I just wanted to check out something. That was why I tried it