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

Function _preprocess_conv1d_input

tensorflow/python/keras/backend.py:4589–4605  ·  view source on GitHub ↗

Transpose and cast the input before the conv1d. Arguments: x: input tensor. data_format: string, `"channels_last"` or `"channels_first"`. Returns: A tensor.

(x, data_format)

Source from the content-addressed store, hash-verified

4587
4588
4589def _preprocess_conv1d_input(x, data_format):
4590 """Transpose and cast the input before the conv1d.
4591
4592 Arguments:
4593 x: input tensor.
4594 data_format: string, `"channels_last"` or `"channels_first"`.
4595
4596 Returns:
4597 A tensor.
4598 """
4599 tf_data_format = 'NWC' # to pass TF Conv2dNative operations
4600 if data_format == 'channels_first':
4601 if not _has_nchw_support():
4602 x = array_ops.transpose(x, (0, 2, 1)) # NCW -> NWC
4603 else:
4604 tf_data_format = 'NCW'
4605 return x, tf_data_format
4606
4607
4608def _preprocess_conv2d_input(x, data_format, force_transpose=False):

Callers 2

conv1dFunction · 0.85
separable_conv1dFunction · 0.85

Calls 2

_has_nchw_supportFunction · 0.85
transposeMethod · 0.80

Tested by

no test coverage detected