def should_alter_output_dim(layer_name, enforce_fixed_output_sizes, input_depth,
                            output_depth):
  """Check if the output_depth for the specified layer should be changed."""
  # Check to see if output_depth should be changed if we are using
  # a depthwise operation and the channel multiplier is returned as 1,
  # which means that the depthwise multiplier could not be set to match
  # output_depth.
  change_dim_for_depthwise = ((layer_name in DEPTHWISE_LAYERS) and
                              (layers.calculate_depthwise_channel_multiplier(
                                  input_depth, output_depth) == 1))
  # See if layer is in LAYERS_TO_FIX_OUTPUT_SIZE and if it is then we
  # know that the output_dim must be input_dim.
  change_dim_for_other = layer_name in LAYERS_TO_FIX_OUTPUT_SIZE
  # Must be sure enforce_fixed_output_sizes is true.
  return ((change_dim_for_depthwise or change_dim_for_other) and
          enforce_fixed_output_sizes)
Check if the output_depth for the specified layer should be changed.
tensor2tensor/models/neural_architecture_search/nas_model.py