void ConfigureSplitLayer(const string& layer_name, const string& blob_name,
    const int blob_idx, const int split_count,
    LayerParameter* split_layer_param) {
  split_layer_param->Clear();
  split_layer_param->add_bottom(blob_name);
  split_layer_param->set_name(SplitLayerName(layer_name, blob_name, blob_idx));
  split_layer_param->set_type(LayerParameter_LayerType_SPLIT);
  for (int k = 0; k < split_count; ++k) {
    split_layer_param->add_top(
        SplitBlobName(layer_name, blob_name, blob_idx, k));
  }
}
Beispiel #2
0
void ConfigureSplitLayer(const string& layer_name, const string& blob_name,
    const int blob_idx, const int split_count, const float loss_weight,
    LayerParameter* split_layer_param) {
  split_layer_param->Clear();
  split_layer_param->add_bottom(blob_name);
  split_layer_param->set_name(SplitLayerName(layer_name, blob_name, blob_idx));
  split_layer_param->set_type("Split");
  for (int k = 0; k < split_count; ++k) {
    split_layer_param->add_top(
        SplitBlobName(layer_name, blob_name, blob_idx, k));
    if (loss_weight) {
      if (k == 0) {
        split_layer_param->add_loss_weight(loss_weight);
      } else {
        split_layer_param->add_loss_weight(0);
      }
    }
  }
}
Beispiel #3
0
void ConfigureSplitLayer(const string& layer_name, const string& blob_name,
    const int_tp blob_idx, const int_tp split_count, const float loss_weight,
    LayerParameter* split_layer_param, const DataType bottom_data_type,
    const DataType top_data_type, const QuantizerParameter* ref_quant_param) {
  QuantizerParameter quant_param;
  if (ref_quant_param) {
    quant_param.CopyFrom(*ref_quant_param);
  }
  quant_param.set_name(blob_name);

  split_layer_param->Clear();
  QuantizerParameter* bottom_quant_param = split_layer_param->
      add_bottom_quantizer();
  bottom_quant_param->CopyFrom(quant_param);
  QuantizerParameter* top1_quant_param = split_layer_param->
      add_top_quantizer();
  top1_quant_param->CopyFrom(quant_param);
  QuantizerParameter* top2_quant_param = split_layer_param->
      add_top_quantizer();
  top2_quant_param->CopyFrom(quant_param);
  split_layer_param->add_bottom(blob_name);
  split_layer_param->set_name(SplitLayerName(layer_name, blob_name, blob_idx));
  split_layer_param->set_type("Split");
  split_layer_param->set_compute_data_type(bottom_data_type);
  split_layer_param->set_top_data_type(top_data_type);
  split_layer_param->set_bottom_data_type(bottom_data_type);
  for (int_tp k = 0; k < split_count; ++k) {
    split_layer_param->add_top(
        SplitBlobName(layer_name, blob_name, blob_idx, k));
    if (loss_weight) {
      if (k == 0) {
        split_layer_param->add_loss_weight(loss_weight);
      } else {
        split_layer_param->add_loss_weight(0);
      }
    }
  }
}