During this scene of The Queen's Justice (HBO's Game of Thrones, S07E03), Tyrion Lannister is laying out and explaining his plan to take Casterly Rock, providing us with a narrated montage of a battle/siege sequence (making use of a kind of Unfolding Plan Montage trope).
The first montage scene (0:25–1:09 in the video above) we get shows the Unsullied attack the walls with ladders and getting decimated, thanks to impressive defenses, as Tyrion describes.
TYRION: The Lannister army is still the army my father built. Well trained and well provisioned. Ten thousand men, at least. They will see us coming. They will be ready.
The gates of Casterly Rock are impregnable. The fight up the walls will be hard. We will be at a disadvantage. Many men will die, just as my father said they would.
—The Queen's Justice, Game of Thrones (S07E03)
While we are first led to believe that this sequence is actually happening in the show's reality, we soon after find out that it's a very poor tactical decision that will surely result in unnecessary death and failure.
Tyrion's plan to use the sewage system to infiltrate the Castle and open the gate from within shows us a montage of Grey Worm successfully capturing Casterly Rock (though with a bitter surprise in the form of Euron Greyjoy)
Does that mean that this first scene/sequence of the Unsullied attacking the walls and getting brutally wiped out didn't actually happen, and is actually a 'What-If?' sequence used to show us, the audience, what would happen, while also fooling us into believing they suffered tragic losses, for dramatic tension? Or did it actually happen, and it was part of the larger plan, and these men dying was the cost of a necessary distraction?