docstr: to_set_layers = [(new_layer, prev_layer), ...]
docstr_tok: ["to_set_layers","=","[","(","new_layer",",","prev_layer",")",",","...","]"]
code: def set_identity4deepen(
      self,
      to_set_layers,
      data_provider,
      batch_size,
      batch_num=1,
      strict=True,
      noise=None,
  ):
      """
      to_set_layers = [(new_layer, prev_layer), ...]
      """
      task_list = {}
      for new_layer, prev_layer in to_set_layers:
          if new_layer.ready:
              continue
          if new_layer.use_bn and strict:
              task_id = id(prev_layer)
              if task_id in task_list:
                  task_list[task_id][1].append(new_layer)
              else:
                  task_list[task_id] = (prev_layer, [new_layer])
          else:
              new_layer.set_identity_layer(strict=strict, noise=noise)
      if len(task_list) > 0:
          model = SimpleConvnet(
              None,
              data_provider,
              None,
              net_config=self,
              only_forward=True,
          )
          task_list = list(task_list.values())
          fetches = [
              prev_layer.output_op for prev_layer, _ in task_list
          ]
          statistics = [[0, 0] for _ in task_list]
          for _i in range(batch_num):
              input_images, _ = data_provider.train.next_batch(
                  batch_size
              )
              outputs = model.sess.run(
                  fetches,
                  feed_dict={
                      model.images: input_images,
                      model.is_training: False,
                  },
              )
              for _j, out in enumerate(outputs):
                  out = out.astype("float32")
                  axis = tuple(range(len(out.shape) - 1))
                  mean = np.mean(out, axis=axis, keepdims=True)
                  variance = np.mean(
                      np.square(out - mean), axis=axis, keepdims=True
                  )
                  mean, variance = np.squeeze(mean), np.squeeze(
                      variance
                  )
                  statistics[_j][0] += mean
                  statistics[_j][1] += variance
          for _j, (prev_layer, new_layers) in enumerate(task_list):
              mean, variance = (
                  statistics[_j][0] / batch_num,
                  statistics[_j][1] / batch_num,
              )
              for new_layer in new_layers:
                  if new_layer.ready:
                      continue
                  param = {
                      "moving_mean": mean,
                      "moving_variance": variance,
                      "epsilon": self.bn_epsilon,
                  }
                  new_layer.set_identity_layer(
                      strict=strict, param=param, noise=noise
                  )
  
imports: from .basic_model import BasicModel
  from ..data_providers.base_provider import DataProvider
  from .layers import ConvLayer, PoolLayer, FCLayer
  from .layer_cascade import LayerCascade
  import tensorflow
  import numpy
label_desc: Use image node_id 14 for calling the SimpleConvnetConfig obj's underlying member method code with example usage: obj.set_identity4deepen(to_set_layers, data_provider, batch_size, batch_num, strict, noise) without return types