Need to find Jacobian of a matrix with respect to another matrix

ADONAI_TZEVAOT: <p><strong>Problem 1:</strong><br>
I have a parameter matrix A and an input matrix X . My output matrix Y is <code>Y=AX</code> . How to find the Jacobian of Y with respect to X?</p>
<p><strong>Problem 2:</strong><br>
I have a parameter matrix A, parameter matrix B and an input matrix X . My output matrix Y is <code>Y=AXB</code> . How to find the Jacobian of Y with respect to X?</p>
<p>Please help!</p>

vainaijr: <p>do you mean to do something like this using pytorch?</p>
<p>Problem 1:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/a/7a7116ecedd0631f5ef99ce7f144d8660316573d.png" data-download-href="https://discuss.pytorch.org/uploads/default/7a7116ecedd0631f5ef99ce7f144d8660316573d" title="Screenshot (941)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/a/7a7116ecedd0631f5ef99ce7f144d8660316573d_2_690x245.png" alt="Screenshot (941)" data-base62-sha1="htaxLBWi9wbZzoH1TB50rZgEwR7" width="690" height="245" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/a/7a7116ecedd0631f5ef99ce7f144d8660316573d_2_690x245.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/a/7a7116ecedd0631f5ef99ce7f144d8660316573d_2_1035x367.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/a/7a7116ecedd0631f5ef99ce7f144d8660316573d_2_1380x490.png 2x" data-dominant-color="2C2C2C"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (941)</span><span class="informations">1814×645 20.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/d/0de331835f76f0455309dd8cdcb19c57ac29e452.png" data-download-href="https://discuss.pytorch.org/uploads/default/0de331835f76f0455309dd8cdcb19c57ac29e452" title="Screenshot (942)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/d/0de331835f76f0455309dd8cdcb19c57ac29e452_2_690x213.png" alt="Screenshot (942)" data-base62-sha1="1YQXWcsP6PeEI056eKRx3GaNlbY" width="690" height="213" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/d/0de331835f76f0455309dd8cdcb19c57ac29e452_2_690x213.png, https://discuss.pytorch.org/uploads/default/optimized/3X/0/d/0de331835f76f0455309dd8cdcb19c57ac29e452_2_1035x319.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/0/d/0de331835f76f0455309dd8cdcb19c57ac29e452_2_1380x426.png 2x" data-dominant-color="313131"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (942)</span><span class="informations">1839×570 17.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>Problem 2:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/0/c02bd493e93310a9b2e0faf887d6500840671f13.png" data-download-href="https://discuss.pytorch.org/uploads/default/c02bd493e93310a9b2e0faf887d6500840671f13" title="Screenshot (945)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c02bd493e93310a9b2e0faf887d6500840671f13_2_690x279.png" alt="Screenshot (945)" data-base62-sha1="rq1zZoaEddTI5TP0tJpHvBXlCo3" width="690" height="279" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c02bd493e93310a9b2e0faf887d6500840671f13_2_690x279.png, https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c02bd493e93310a9b2e0faf887d6500840671f13_2_1035x418.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/c/0/c02bd493e93310a9b2e0faf887d6500840671f13_2_1380x558.png 2x" data-dominant-color="2C2C2C"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (945)</span><span class="informations">1802×730 30.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/0/d04bdf4b2fd844d3673473d49bc9343390376c8a.png" data-download-href="https://discuss.pytorch.org/uploads/default/d04bdf4b2fd844d3673473d49bc9343390376c8a" title="Screenshot (946)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d04bdf4b2fd844d3673473d49bc9343390376c8a_2_690x113.png" alt="Screenshot (946)" data-base62-sha1="tIFRTTC2s4wMF0ov6A6KB5F32uC" width="690" height="113" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d04bdf4b2fd844d3673473d49bc9343390376c8a_2_690x113.png, https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d04bdf4b2fd844d3673473d49bc9343390376c8a_2_1035x169.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d04bdf4b2fd844d3673473d49bc9343390376c8a_2_1380x226.png 2x" data-dominant-color="2F2F2F"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (946)</span><span class="informations">1851×304 13.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>