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

Function _expand_mask

tensorflow/python/keras/backend.py:3819–3826  ·  view source on GitHub ↗
(mask_t, input_t, fixed_dim=1)

Source from the content-addressed store, hash-verified

3817 # That's what the tile call does, it just repeats the mask along its
3818 # second dimension n times.
3819 def _expand_mask(mask_t, input_t, fixed_dim=1):
3820 assert not nest.is_sequence(mask_t)
3821 assert not nest.is_sequence(input_t)
3822 rank_diff = len(input_t.shape) - len(mask_t.shape)
3823 for _ in range(rank_diff):
3824 mask_t = array_ops.expand_dims(mask_t, -1)
3825 multiples = [1] * fixed_dim + input_t.shape.as_list()[fixed_dim:]
3826 return array_ops.tile(mask_t, multiples)
3827
3828 if unroll:
3829 if not time_steps:

Callers 2

rnnFunction · 0.85
_stepFunction · 0.85

Calls 4

tileMethod · 0.80
rangeFunction · 0.50
expand_dimsMethod · 0.45
as_listMethod · 0.45

Tested by

no test coverage detected