# Course 4 Week 4 Assignment 2 Issue: Art generation with neural style transfer

**URL:** <https://community.deeplearning.ai/t/course-4-week-4-assignment-2-issue-art-generation-with-neural-style-transfer/880786>\
**Category:** Convolutional Neural Networks\
**Tags:** week-module-4\
**Created:** [October 5, 2025, 5:01pm UTC](https://community.deeplearning.ai/t/course-4-week-4-assignment-2-issue-art-generation-with-neural-style-transfer/880786 "2025-10-05T17:01:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhruv\_A](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@Dhruv\_A](https://community.deeplearning.ai/u/Dhruv_A)\
**Post date:** [October 5, 2025, 5:01pm UTC](https://community.deeplearning.ai/t/course-4-week-4-assignment-2-issue-art-generation-with-neural-style-transfer/880786/1 "2025-10-05T17:01:33Z")

</div>

I am implementing compute\_layer\_style\_cost function in week 4 assignment 2, but it is returning error and I am not able to figure out why wrong value is coming.

Any help is appreciated ! Thanks

 ![image](https://global.discourse-cdn.com/dlai/original/3X/6/0/60cb0bb714a0c1ca7b7830adf0920c01380caef4.png)

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [October 5, 2025, 5:43pm UTC](https://community.deeplearning.ai/t/course-4-week-4-assignment-2-issue-art-generation-with-neural-style-transfer/880786/2 "2025-10-05T17:43:43Z")

</div>

The most common error in that function has to do with the “reshape” operation that is required for `a_S` and `a_G`. Please note that you can’t just reshape directly to the final shape you want, because that scrambles the data. [Here’s a thread](https://community.deeplearning.ai/t/neural-style-transfer-programming-exercise-compute-content-cost-reshape-confusion/231502/9) which delves into that point and demonstrates why a transpose is required.
