import tensorflow as tf



def split_by_labels(tensor, num_of_labels):
  assert len(x.get_shape()) >= 2
  #assert x.get_shape()[0] == (batch size)
  #assert x.get_shape()[1] == (values concatenated by labels)

  return tf.split(1, num_of_labels, tensor)


def concat_by_labels(tensors):
  assert len(x.get_shape()) >= 1
  #assert x.get_shape()[0] == (batch size)

  def reshape_tensor(tensor):
    return tf.reshape(tensor,
                      [tensors.get_shape()[0], 1]
                      + list(tensors.get_shape()[1:]))

  return tf.concat(1, map(reshape_tensor, tensors))

@@ -69,33 +69,38 @@
 ):%0A  assert len(
-x
+tensor
 .get_shape()) %3E=
@@ -104,33 +104,38 @@
  %3E= 2%0A  #assert 
-x
+tensor
 .get_shape()%5B0%5D 
@@ -152,33 +152,38 @@
 size)%0A  #assert 
-x
+tensor
 .get_shape()%5B1%5D 
@@ -308,17 +308,23 @@
 ert len(
-x
+tensors
 .get_sha
@@ -348,9 +348,15 @@
 ert 
-x
+tensors
 .get
@@ -384,16 +384,65 @@
  size)%0A%0A
+  tensors_shape = tensors.get_shape().as_list()%0A%0A
   def re
@@ -496,113 +496,54 @@
 sor,
-%0A                      %5B
+ 
 tensors
-.get
 _shape
-()%5B0%5D, 1%5D%0A                      + list(
+%5B0:1%5D + %5B1%5D + 
 tensors
-.get
 _shape
-()
 %5B1:%5D)
-)
 %0A%0A  

Fix bugs in nn.mlmc.util module