returnn.tf.frontend_layers._utils
¶
Some utilities for internal use
- returnn.tf.frontend_layers._utils.unique_tensor_list(tensors: Iterable[Tensor]) List[Tensor] [source]¶
- returnn.tf.frontend_layers._utils.copy(tensor: Tensor[Layer], *, name: Layer | str) Tensor[Layer] [source]¶
- returnn.tf.frontend_layers._utils.identity_with_control_deps(tensor: Tensor[Layer], control_deps: Sequence[Tensor[Layer]], *, name: str | Layer | None = None) Tensor[Layer] [source]¶
- Parameters:
tensor
control_deps
name
- Returns:
tensor with control deps
- returnn.tf.frontend_layers._utils.constant_value(x: Tensor[Layer]) int | float | complex | bool | str | None [source]¶
If the tensor is a constant, return its value.
- returnn.tf.frontend_layers._utils.zeros_like_as_output_in_scope(tensor: Tensor, *, name: Layer)[source]¶
- Parameters:
tensor
name
- Returns:
- returnn.tf.frontend_layers._utils.mark_as_output_in_scope(tensor: Tensor, scope: Layer) Tensor [source]¶
Mark this as an output.
Will combine (concat or add or so) all the last hidden states from all sources.
- Parameters:
source (nn.Tensor)
out_dim (nn.Dim|None)
combine (str) – “concat” or “add”
key (str|int|None) – for the state, which could be a namedtuple. see
RnnCellLayer.get_state_by_key()
- Returns:
layer