MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / forward

Method forward

tensorlayer/layers/pooling.py:959–985  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

957 pass
958
959 def forward(self, inputs):
960 input_width = inputs.shape[2]
961 input_height = inputs.shape[1]
962 batch_min = tf.reduce_min(inputs)
963 if self.mode == 'TopLeft':
964 temp_bottom = tf.pad(
965 inputs, tf.constant([[0, 0], [0, input_height - 1], [0, 0], [0, 0]]), constant_values=batch_min
966 )
967 temp_right = tf.pad(
968 inputs, tf.constant([[0, 0], [0, 0], [0, input_width - 1], [0, 0]]), constant_values=batch_min
969 )
970 temp_bottom = tf.nn.max_pool(temp_bottom, ksize=(input_height, 1), strides=(1, 1), padding='VALID')
971 temp_right = tf.nn.max_pool(temp_right, ksize=(1, input_width), strides=(1, 1), padding='VALID')
972 outputs = tf.add(temp_bottom, temp_right, name=self.name)
973 elif self.mode == 'BottomRight':
974 temp_top = tf.pad(
975 inputs, tf.constant([[0, 0], [input_height - 1, 0], [0, 0], [0, 0]]), constant_values=batch_min
976 )
977 temp_left = tf.pad(
978 inputs, tf.constant([[0, 0], [0, 0], [input_width - 1, 0], [0, 0]]), constant_values=batch_min
979 )
980 temp_top = tf.nn.max_pool(temp_top, ksize=(input_height, 1), strides=(1, 1), padding='VALID')
981 temp_left = tf.nn.max_pool(temp_left, ksize=(1, input_width), strides=(1, 1), padding='VALID')
982 outputs = tf.add(temp_top, temp_left, name=self.name)
983 else:
984 outputs = tf.identity(inputs, name=self.name)
985 return outputs

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected