MCPcopy Create free account
hub / github.com/deepdrive/deepdrive / conv

Function conv

tensorflow_agent/layers.py:6–23  ·  view source on GitHub ↗

From https://github.com/ethereon/caffe-tensorflow

(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1)

Source from the content-addressed store, hash-verified

4
5
6def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1):
7 '''From https://github.com/ethereon/caffe-tensorflow
8 '''
9 c_i = input.get_shape()[-1]
10 assert c_i % group == 0
11 assert c_o % group == 0
12
13 def convolve(i, k):
14 return tf.nn.conv2d(i, k, [1, s_h, s_w, 1], padding=padding)
15
16 if group == 1:
17 conv = convolve(input, kernel)
18 else:
19 input_groups = tf.split(input, group, 3)
20 kernel_groups = tf.split(kernel, group, 3)
21 output_groups = [convolve(i, k) for i, k in zip(input_groups, kernel_groups)]
22 conv = tf.concat(output_groups, 3)
23 return tf.reshape(tf.nn.bias_add(conv, biases), [-1] + conv.get_shape().as_list()[1:])
24
25
26def conv2d(x, name, num_features, kernel_size, stride, group):

Callers 1

conv2dFunction · 0.85

Calls 1

convolveFunction · 0.85

Tested by

no test coverage detected