def _block_group(self, inputs, filters, strides, block_fn_cand, block_repeats=1, name='block_group'):
    'Creates one group of blocks for the SpineNet model.'
    block_fn_candidates = {'bottleneck': nn_blocks.BottleneckBlock, 'residual': nn_blocks.ResidualBlock}
    block_fn = block_fn_candidates[block_fn_cand]
    (_, _, _, num_filters) = inputs.get_shape().as_list()
    if (block_fn_cand == 'bottleneck'):
        use_projection = (not ((num_filters == (filters * 4)) and (strides == 1)))
    else:
        use_projection = (not ((num_filters == filters) and (strides == 1)))
    x = block_fn(filters=filters, strides=strides, use_projection=use_projection, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer, activation=self._activation, use_sync_bn=self._use_sync_bn, norm_momentum=self._norm_momentum, norm_epsilon=self._norm_epsilon)(inputs)
    for _ in range(1, block_repeats):
        x = block_fn(filters=filters, strides=1, use_projection=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer, activation=self._activation, use_sync_bn=self._use_sync_bn, norm_momentum=self._norm_momentum, norm_epsilon=self._norm_epsilon)(x)
    return tf.identity(x, name=name)
Creates one group of blocks for the SpineNet model.
def _block_group(self, inputs, filters, strides, block_fn_cand, block_repeats=1, name='block_group'):
    
    block_fn_candidates = {'bottleneck': nn_blocks.BottleneckBlock, 'residual': nn_blocks.ResidualBlock}
    block_fn = block_fn_candidates[block_fn_cand]
    (_, _, _, num_filters) = inputs.get_shape().as_list()
    if (block_fn_cand == 'bottleneck'):
        use_projection = (not ((num_filters == (filters * 4)) and (strides == 1)))
    else:
        use_projection = (not ((num_filters == filters) and (strides == 1)))
    x = block_fn(filters=filters, strides=strides, use_projection=use_projection, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer, activation=self._activation, use_sync_bn=self._use_sync_bn, norm_momentum=self._norm_momentum, norm_epsilon=self._norm_epsilon)(inputs)
    for _ in range(1, block_repeats):
        x = block_fn(filters=filters, strides=1, use_projection=False, kernel_initializer=self._kernel_initializer, kernel_regularizer=self._kernel_regularizer, bias_regularizer=self._bias_regularizer, activation=self._activation, use_sync_bn=self._use_sync_bn, norm_momentum=self._norm_momentum, norm_epsilon=self._norm_epsilon)(x)
    return tf.identity(x, name=name)