Every line of 'maxpool2d keras' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
143 def maxpool (x): 144 return MaxPooling2D(pool_size=(2, 2), strides=None, padding="valid")(x)
90 def max_pool2d(name,input,ksize=(1,2,2,1),strides=(1,2,2,1)): 91 # the standard pooling 92 return 93 tf.nn.max_pool(input, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
91 def _max_pool(layer_name, inputs, paddings, strides, ksize=[2, 2]): 92 ksize = [1, ksize[0], ksize[1], 1] 93 strides = [1, strides[0], strides[1], 1] 94 p_h, p_w = paddings[0], paddings[1] 95 paddings = [[0, 0], [p_h, p_h], [p_w, p_w], [0, 0]] 96 97 with tf.variable_scope(layer_name): 98 x = tf.pad(inputs, paddings=paddings) 99 max_pool_ = tf.nn.max_pool(value=x, ksize=ksize, strides=strides, padding='VALID', name='max_pool') 100 return max_pool_
25 def max_pool_layer3d(x, kernel_size=(2, 2, 2), strides=(2, 2, 2), padding="SAME"): 26 ''' 27 3D max pooling layer with 2x2x2 pooling as default 28 ''' 29 30 kernel_size_aug = [1, kernel_size[0], kernel_size[1], kernel_size[2], 1] 31 strides_aug = [1, strides[0], strides[1], strides[2], 1] 32 33 op = tf.nn.max_pool3d(x, ksize=kernel_size_aug, strides=strides_aug, padding=padding) 34 35 return op
15 def maxPool(input, stride=2, kernel=2, padding='SAME', name='pool'): 16 return tf.nn.max_pool(input, ksize=[1, kernel, kernel, 1], strides=[1, stride, stride, 1], padding='SAME', name=name)
158 def _max_pool_layer(self, x, pool_size, stride): 159 with tf.name_scope('max_pool') as name_scope: 160 x = tf.layers.max_pooling2d( 161 x, pool_size, stride, 'SAME', data_format=self._data_format) 162 tf.logging.info('image after unit %s: %s', name_scope, x.get_shape()) 163 return x
274 def _pooling_function(self, inputs, pool_size, strides, 275 border_mode, dim_ordering): 276 output = K.pool2d(inputs, pool_size, strides, 277 border_mode, dim_ordering, pool_mode='avg') 278 return output
217 def max_pool(*args, **kwargs): 218 return backend()["max_pool"](*args, **kwargs)
52 def maxpool(x): 53 return tf.nn.max_pool(x, ksize=[1, 3, 3, 1], 54 strides=[1, 2, 2, 1], padding='SAME')
89 def maxpool(input, output_size, params, flatten=False): 90 shape = tf.concat([tf.shape(input)[:-1], [output_size, params.maxnum]], 91 axis=0) 92 value = tf.reshape(input, shape) 93 output = tf.reduce_max(value, -1) 94 weight_ratio = wr.weight_ratio_maxpool(input, output, params.maxnum, 95 flatten=flatten) 96 return {"output": output, "weight_ratio": weight_ratio}