Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions TENSORBOX/utils/kaffe/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import tensorflow as tf

DEFAULT_PADDING = 'SAME'
tf_major_ver = int(tf.__version__.split(".")[0])
tf_minor_ver = int(tf.__version__.split(".")[1])

def layer(op):
def layer_decorated(self, *args, **kwargs):
Expand Down Expand Up @@ -88,7 +90,10 @@ def conv(self, input, k_h, k_w, c_o, s_h, s_w, name, relu=True, padding=DEFAULT_
input_groups = tf.split(3, group, input)
kernel_groups = tf.split(3, group, kernel)
output_groups = [convolve(i, k) for i,k in zip(input_groups, kernel_groups)]
conv = tf.concat(3, output_groups)
if(tf_major_ver==0):
conv = tf.concat(3, output_groups)
else:
conv = tf.concat(output_groups,3)
if relu:
bias = tf.reshape(tf.nn.bias_add(conv, biases), conv.get_shape().as_list())
return tf.nn.relu(bias, name=scope.name)
Expand Down Expand Up @@ -127,7 +132,10 @@ def lrn(self, input, radius, alpha, beta, name, bias=1.0):

@layer
def concat(self, inputs, axis, name):
return tf.concat(concat_dim=axis, values=inputs, name=name)
if(tf_major_ver==0):
return tf.concat(concat_dim=axis, values=inputs, name=name)
else:
return tf.concat(axis=axis, values=inputs, name=name)

@layer
def fc(self, input, num_out, name, relu=True):
Expand Down