25def _channelwiseMinMax(tensors: Tensors, channel: int) -> Tuple[List[float], List[float]]:
26 """
27 Compute channel-wise min and max for the tensor.
28 :param tensors: a list of numpy array (each is a tensor)
29 :param channel: number of channels
30 :return: lists of min and max for each channel
31 """
32 channel_wise_min = []
33 channel_wise_max = []
34 for c in range(channel):
35 min_act = min(tensors, key=lambda activation: np.min(activation[:, :, :, c]))
36 max_act = max(tensors, key=lambda activation: np.max(activation[:, :, :, c]))
37 channel_wise_min.append(float(np.min(min_act[:, :, :, c])))
38 channel_wise_max.append(float(np.max(max_act[:, :, :, c])))
39 return channel_wise_min, channel_wise_max
40
41