(x)
| 71 | |
| 72 | |
| 73 | def UnPooling2x2ZeroFilled(x): |
| 74 | # https://github.com/tensorflow/tensorflow/issues/2169 |
| 75 | out = tf.concat([x, tf.zeros_like(x)], 3) |
| 76 | out = tf.concat([out, tf.zeros_like(out)], 2) |
| 77 | |
| 78 | sh = x.get_shape().as_list() |
| 79 | if None not in sh[1:]: |
| 80 | out_size = [-1, sh[1] * 2, sh[2] * 2, sh[3]] |
| 81 | return tf.reshape(out, out_size) |
| 82 | else: |
| 83 | shv = tf.shape(x) |
| 84 | ret = tf.reshape(out, tf.stack([-1, shv[1] * 2, shv[2] * 2, sh[3]])) |
| 85 | return ret |
| 86 | |
| 87 | |
| 88 | @layer_register(log_shape=True) |