(params)
return sizes
In a progressive GAN, the number of channels can change after each
    upsampling.  This function reads the state dict to figure the
    number of upsamplings and the channel depth of each filter.
In a progressive GAN, the number of channels can change after each
    upsampling.  This function reads the state dict to figure the
    number of upsamplings and the channel depth of each filter.
In a progressive GAN the number of channels can change after each upsampling . This function reads the state dict to figure the number of upsamplings and the channel depth of each filter .
def sizes_from_state_dict(params):
    '''
    In a progressive GAN, the number of channels can change after each
    upsampling.  This function reads the state dict to figure the
    number of upsamplings and the channel depth of each filter.
    '''
    sizes = []
    for i in itertools.count():
        pt_layername = 'layer%d' % (i + 1)
        try:
            weight = params['%s.conv.weight' % pt_layername]
        except KeyError:
            break
        if i == 0:
            sizes.append(weight.shape[1])
        if i % 2 == 0:
            sizes.append(weight.shape[0])
    return sizes
def sizes_from_state_dict ( params ) : sizes = [ ] for i in itertools . count ( ) : pt_layername = 'layer%d' % ( i + 1 ) try : weight = params [ '%s.conv.weight' % pt_layername ] except KeyError : break if i == 0 : sizes . append ( weight . shape [ 1 ] ) if i % 2 == 0 : sizes . append ( weight . shape [ 0 ] ) return sizes