Для меня это звучит не как пул по каналам (который должен генерировать один выходной канал), а по элементам МАКС. Операция:
layer {
name: "input_1"
type: "Input"
top: "input_1"
input_param {
shape {
dim: 1
dim: 2
dim: 3
dim: 3
}
}
}
layer {
name: "input_2"
type: "Input"
top: "input_2"
input_param {
shape {
dim: 1
dim: 2
dim: 3
dim: 3
}
}
}
layer {
name: "channel_max"
type: "Eltwise"
bottom: "input_1"
bottom: "input_2"
top: "channel_max"
eltwise_param {
operation: MAX
}
}
Следующий код:
import caffe
import numpy as np
caffe.set_mode_cpu()
net = caffe.Net('net.prototxt', 1)
net.blobs['input_1'].data[...] = np.random.randint(10, size=(1, 2, 3, 3))
net.blobs['input_2'].data[...] = np.random.randint(10, size=(1, 2, 3, 3))
net.forward()
print('Blob #1:')
print(net.blobs['input_1'].data)
print('Blob #2:')
print(net.blobs['input_2'].data)
print('Result:')
print(net.blobs['channel_max'].data)
Объединяет два больших объекта в один с одинаковым количеством каналов, заполненных максимальными значениями карт объектов:
Blob #1:
[[[[5. 6. 5.]
[1. 6. 1.]
[4. 7. 6.]]
[[9. 8. 3.]
[8. 8. 8.]
[6. 9. 9.]]]]
Blob #2:
[[[[4. 1. 1.]
[2. 1. 3.]
[6. 1. 0.]]
[[3. 8. 7.]
[8. 2. 4.]
[2. 8. 1.]]]]
Result:
[[[[5. 6. 5.]
[2. 6. 3.]
[6. 7. 6.]]
[[9. 8. 7.]
[8. 8. 8.]
[6. 9. 9.]]]]