Different loop output every x posts in custom post type

After quite a bit of trial and error, I got the code set up correctly for the WordPress loop. I put it into a shortcode. Here it is:

add_shortcode( 'partnerlogos', 'display_partner_logos' );
function display_partner_logos(){
    // Define the query
    $args = array(
        'post_type' => 'dnf_partner_logos',
        'post_status' => 'publish'
    );

    $query = new WP_Query( $args ); ?>

<!-- Carousel
================================================== -->
<div id="partnersCarousel" class="carousel slide">
    <div class="carousel-inner">
        <?php $count = 0;
        while ($query->have_posts()) : $query->the_post();
            $image = get_field('partner_logo');
            $url = $image['url'];
            $size="dnf-partners";
            $thumb = $image['sizes'][ $size ];
            $width = $image['sizes'][ $size . '-width' ];
            $height = $image['sizes'][ $size . '-height' ];

        if($count % 4 == 0) { ?>

        <div class="item <?php if($count == 0) echo "active"; ?>">
            <div class="row">

        <?php } ?>

                <div <?php post_class("col-md-3") ?> id="post-<?php the_ID(); ?>">
                    <a href="#" class="thumbnail">
                        <img src="https://wordpress.stackexchange.com/questions/217096/<?php echo $thumb; ?>" class="img-responsive" alt="Thumb11">
                    </a>
                </div>

        <?php if($count % 4 == 3) { ?>   
            </div>
        </div>

        <?php } 
            $count++;
        endwhile;

        if($count % 4 != 0) { ?>
        </div>
    </div>
    <?php } ?>

</div>

<a class="left carousel-control" href="#partnersCarousel" data-slide="prev"><i class="fa fa-chevron-left fa-2x"></i></a>
<a class="right carousel-control" href="#partnersCarousel" data-slide="next"><i class="fa fa-chevron-right fa-2x"></i></a>

</div>

<?php     
    wp_reset_postdata();
    wp_reset_query();
}