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

Function _assert_has_shape

tensorflow/lite/experimental/examples/lstm/rnn.py:241–248  ·  view source on GitHub ↗
(x, shape)

Source from the content-addressed store, hash-verified

239 state = cell.zero_state(batch_size, dtype)
240
241 def _assert_has_shape(x, shape):
242 x_shape = array_ops.shape(x)
243 packed_shape = array_ops.stack(shape)
244 return control_flow_ops.Assert(
245 math_ops.reduce_all(math_ops.equal(x_shape, packed_shape)), [
246 "Expected shape for Tensor %s is " % x.name, packed_shape,
247 " but saw shape: ", x_shape
248 ])
249
250 if not context.executing_eagerly() and sequence_length is not None:
251 # Perform some shape validation

Callers 1

dynamic_rnnFunction · 0.70

Calls 3

equalMethod · 0.80
shapeMethod · 0.45
stackMethod · 0.45

Tested by

no test coverage detected