MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _CreateDenseMaskAndBegin

Function _CreateDenseMaskAndBegin

tensorflow/python/ops/array_grad.py:71–83  ·  view source on GitHub ↗

Create variables for iteratively slicing a dense gradients tensor.

(sizes, concat_dim)

Source from the content-addressed store, hash-verified

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."""

Callers 1

_ConcatGradHelperFunction · 0.85

Calls 4

fillMethod · 0.80
shapeMethod · 0.45
concatMethod · 0.45
expand_dimsMethod · 0.45

Tested by

no test coverage detected