Create variables for iteratively slicing a dense gradients tensor.
(sizes, concat_dim)
| 69 | """ |
| 70 | |
| 71 | def _CreateDenseMaskAndBegin(sizes, concat_dim): |
| 72 | """Create variables for iteratively slicing a dense gradients tensor.""" |
| 73 | # Since shape is 1-D, shape_of_shape = [rank-of-inputs] |
| 74 | shape_of_shape = array_ops.shape(sizes[0]) |
| 75 | # Make a vector of length equal to the input's dimensions, |
| 76 | # with 0's everywhere and 1 in the concat dim position. |
| 77 | # Note: Can't use sparse_to_dense since it isn't GPU-capable (for now) |
| 78 | mask = array_ops.concat([ |
| 79 | array_ops.fill(array_ops.expand_dims(concat_dim, 0), 0), [1], |
| 80 | array_ops.fill(shape_of_shape - concat_dim - 1, 0) |
| 81 | ], 0) |
| 82 | begin = array_ops.fill(shape_of_shape, 0) |
| 83 | return mask, begin |
| 84 | |
| 85 | def _ExtractInputShapes(inputs): |
| 86 | """Extract the shapes of a set of input tensors.""" |
no test coverage detected