o
    ®Ÿ?eb  ã                   @   s,  d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z  e !dg d¢¡Z"edej#ej$ƒZ%d<dej&e% dej&ej' de(de(de)f
dd„Z*edƒe +e*¡ƒZ,dej&e% dej&ej' de(de(de)f
dd„Z-e !dg d¢¡Z.edej#ej$ƒZ/d=dej&e/ dej&ej' de)d"e(fd#d$„Z0ed%ƒe +e0¡ƒZ1dej&e/ dej&ej' de)d"e(fd&d'„Z2e !d(d)d*g¡Z3ed+ej#ej$ƒZ4d>dej&e4 d,ej&ej5 d-ej&ej' dej&ej' d.e)d/e)d0e)fd1d2„Z6ed3ƒe +e6¡ƒZ7dej&e4 d,ej&ej5 d-ej&ej' dej&ej' d.e)d/e)d0e)fd4d5„Z8e !d6d)d*g¡Z9d>dej&ej# d,ej&ej5 d-ej&ej' dej&ej' d.e)d/e)d0e)fd7d8„Z:ed9ƒe +e:¡ƒZ;dej&ej# d,ej&ej5 d-ej&ej' dej&ej' d.e)d/e)d0e)fd:d;„Z<dS )?zUPython wrappers around TensorFlow ops.

This file is MACHINE GENERATED! Do not edit.
é    N)Ú
pywrap_tfe)Úcontext)Úcore)Úexecute)Údtypes)Úannotation_types)Úop_def_registry)Úops)Úop_def_library)Údeprecated_endpoints)Údispatch)Ú	tf_export)ÚTypeVarÚListÚCTCBeamSearchDecoder)Zdecoded_indicesZdecoded_valuesZdecoded_shapeZlog_probabilityÚTV_CTCBeamSearchDecoder_TTÚinputsÚsequence_lengthÚ
beam_widthÚ	top_pathsÚmerge_repeatedc                 C   sæ  t j pt  ¡ }|j}|jr^zt |d|| |d|d|d|¡}t |¡}|W S  tj	y= }	 zt
 |	|¡ W Y d}	~	nd}	~	w tjyF   Y nw zt| ||||||dW S  tjy]   Y nw t |d¡}t |d¡}|du rpd}t |d¡}tjd| |||||d\}
}
}}|dd… }t ¡ r±d| d¡d| d¡d| d¡d	| d	¡f}|j}t d|||¡ |d|… g||d…  }|dd
… |d
d
| … g |d
| d…  }|dd… |dd| … g |d| d…  }t |¡}|S )a  Performs beam search decoding on the logits given in input.

  A note about the attribute merge_repeated: For the beam search decoder,
  this means that if consecutive entries in a beam are the same, only
  the first of these is emitted.  That is, when the top path is "A B B B B",
  "A B" is returned if merge_repeated = True but "A B B B B" is
  returned if merge_repeated = False.

  Args:
    inputs: A `Tensor`. Must be one of the following types: `float32`, `float64`.
      3-D, shape: `(max_time x batch_size x num_classes)`, the logits.
    sequence_length: A `Tensor` of type `int32`.
      A vector containing sequence lengths, size `(batch)`.
    beam_width: An `int` that is `>= 1`.
      A scalar >= 0 (beam search beam width).
    top_paths: An `int` that is `>= 1`.
      A scalar >= 0, <= beam_width (controls output size).
    merge_repeated: An optional `bool`. Defaults to `True`.
      If true, merge repeated classes in output.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (decoded_indices, decoded_values, decoded_shape, log_probability).

    decoded_indices: A list of `top_paths` `Tensor` objects with type `int64`.
    decoded_values: A list of `top_paths` `Tensor` objects with type `int64`.
    decoded_shape: A list of `top_paths` `Tensor` objects with type `int64`.
    log_probability: A `Tensor`. Has the same type as `inputs`.
  r   r   r   r   N)r   r   r   ÚnameÚctxT)r   r   r   r   r   r   ÚTé   é   )Ú_contextr   Ú_thread_local_dataÚis_eagerr   ÚTFE_Py_FastPathExecuteÚ_CTCBeamSearchDecoderOutputÚ_makeÚ_coreÚ_NotOkStatusExceptionÚ_opsÚraise_from_not_ok_statusÚ_FallbackExceptionÚ&ctc_beam_search_decoder_eager_fallbackÚ_SymbolicExceptionÚ_executeÚmake_intÚ	make_boolÚ_op_def_libraryÚ_apply_op_helperÚmust_record_gradientÚ_get_attr_intÚ_get_attr_boolÚ_get_attr_typer   Úrecord_gradient)r   r   r   r   r   r   Ú_ctxÚtldÚ_resultÚeÚ_Ú_opÚ_outputsÚ_attrsÚ_inputs_flat© r<   úb/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/ops/gen_ctc_ops.pyÚctc_beam_search_decoder   sh   

ý
€ÿþÿü

ýÿ..
r>   zraw_ops.CTCBeamSearchDecoderc                 C   s:  t  |d¡}t  |d¡}|d u rd}t  |d¡}t  | g|tjtjgtj¡\}\} t |tj	¡}| |g}d|d|d|d|f}	t j
d|| | d ||	||d}
t  ¡ r[t  d	||	|
¡ |
d |… g|
|d …  }
|
d d… |
dd| … g |
d| d …  }
|
d d
… |
d
d
| … g |
d
| d …  }
t |
¡}
|
S )Nr   r   Tr   r   s   CTCBeamSearchDecoderr   ©r   Úattrsr   r   r   r   )r)   r*   r+   Úargs_to_matching_eagerÚ_dtypesÚfloat32Úfloat64r$   Úconvert_to_tensorÚint32r   r.   r2   r    r!   )r   r   r   r   r   r   r   Ú_attr_Tr;   r:   r5   r<   r<   r=   r'   m   s8   "ÿÿÿþÿ..
r'   ÚCTCGreedyDecoderÚTV_CTCGreedyDecoder_TFéÿÿÿÿÚblank_indexc                 C   s^  t j pt  ¡ }|j}|jr[zt |d|| |d|d|¡	}t |¡}|W S  tj	y; } zt
 ||¡ W Y d}~nd}~w tjyD   Y nw zt| |||||dW S  tjyZ   Y nw |du rad}t |d¡}|du rmd}t |d¡}tjd| ||||d\}	}	}
}|dd… }t ¡ r¨d|
 d¡d|
 d¡d	|
 d	¡f}|
j}t d|||¡ t |¡}|S )
a7  Performs greedy decoding on the logits given in inputs.

  A note about the attribute merge_repeated: if enabled, when
  consecutive logits' maximum indices are the same, only the first of
  these is emitted.  Labeling the blank '*', the sequence "A B B * B B"
  becomes "A B B" if merge_repeated = True and "A B B B B" if
  merge_repeated = False.

  Regardless of the value of merge_repeated, if the maximum index of a given
  time and batch corresponds to the blank, index `(num_classes - 1)`, no new
  element is emitted.

  Args:
    inputs: A `Tensor`. Must be one of the following types: `float32`, `float64`.
      3-D, shape: `(max_time x batch_size x num_classes)`, the logits.
    sequence_length: A `Tensor` of type `int32`.
      A vector containing sequence lengths, size `(batch_size)`.
    merge_repeated: An optional `bool`. Defaults to `False`.
      If True, merge repeated classes in output.
    blank_index: An optional `int`. Defaults to `-1`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (decoded_indices, decoded_values, decoded_shape, log_probability).

    decoded_indices: A `Tensor` of type `int64`.
    decoded_values: A `Tensor` of type `int64`.
    decoded_shape: A `Tensor` of type `int64`.
    log_probability: A `Tensor`. Has the same type as `inputs`.
  rH   r   rK   N)r   rK   r   r   FrJ   )r   r   r   rK   r   r   )r   r   r   r   r   r   Ú_CTCGreedyDecoderOutputr!   r"   r#   r$   r%   r&   Ú!ctc_greedy_decoder_eager_fallbackr(   r)   r+   r*   r,   r-   r.   r0   r/   r1   r   r2   )r   r   r   rK   r   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r<   r=   Úctc_greedy_decoder‹   s^   
þ
€ÿþÿý
þÿ
rN   zraw_ops.CTCGreedyDecoderc           
      C   s´   |d u rd}t  |d¡}|d u rd}t  |d¡}t  | g|tjtjgtj¡\}\} t |tj	¡}| |g}d|d|d|f}t j
dd||||d}	t  ¡ rSt  d	|||	¡ t |	¡}	|	S )
NFr   rJ   rK   r   s   CTCGreedyDecoderé   r?   rH   )r)   r+   r*   rA   rB   rC   rD   r$   rE   rF   r   r.   r2   rL   r!   )
r   r   r   rK   r   r   rG   r;   r:   r5   r<   r<   r=   rM   Ö   s*   "
ÿ
ÿÿ
rM   ÚCTCLossZlossZgradientÚTV_CTCLoss_TÚlabels_indicesÚlabels_valuesÚpreprocess_collapse_repeatedÚctc_merge_repeatedÚ!ignore_longer_outputs_than_inputsc                 C   s”  t j pt  ¡ }|j}	|	jrbzt |d|| |||d|d|d|¡}
t |
¡}
|
W S  tj	y? } zt
 ||¡ W Y d}~nd}~w tjyH   Y nw zt| ||||||||d	W S  tjya   Y nw |du rhd}t |d¡}|du rtd}t |d¡}|du r€d}t |d¡}tjd| |||||||d		\}}}}|dd… }
t ¡ rÃd| d¡d| d¡d| d¡d
| d
¡f}|j}t d|||
¡ t |
¡}
|
S )aÆ  Calculates the CTC Loss (log probability) for each batch entry.  Also calculates

  the gradient.  This class performs the softmax operation for you, so inputs
  should be e.g. linear projections of outputs by an LSTM.

  Args:
    inputs: A `Tensor`. Must be one of the following types: `float32`, `float64`.
      3-D, shape: `(max_time x batch_size x num_classes)`, the logits.
    labels_indices: A `Tensor` of type `int64`.
      The indices of a `SparseTensor<int32, 2>`.
      `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for
      `(batch b, time t)`.
    labels_values: A `Tensor` of type `int32`.
      The values (labels) associated with the given batch and time.
    sequence_length: A `Tensor` of type `int32`.
      A vector containing sequence lengths (batch).
    preprocess_collapse_repeated: An optional `bool`. Defaults to `False`.
      Scalar, if true then repeated labels are
      collapsed prior to the CTC calculation.
    ctc_merge_repeated: An optional `bool`. Defaults to `True`.
      Scalar.  If set to false, *during* CTC calculation
      repeated non-blank labels will not be merged and are interpreted as
      individual labels.  This is a simplified version of CTC.
    ignore_longer_outputs_than_inputs: An optional `bool`. Defaults to `False`.
      Scalar. If set to true, during CTC
      calculation, items that have longer output sequences than input sequences
      are skipped: they don't contribute to the loss term and have zero-gradient.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (loss, gradient).

    loss: A `Tensor`. Has the same type as `inputs`.
    gradient: A `Tensor`. Has the same type as `inputs`.
  rP   rT   rU   rV   N©rT   rU   rV   r   r   FT©r   rR   rS   r   rT   rU   rV   r   r   )r   r   r   r   r   r   Ú_CTCLossOutputr!   r"   r#   r$   r%   r&   Úctc_loss_eager_fallbackr(   r)   r+   r,   r-   r.   r0   r1   r   r2   ©r   rR   rS   r   rT   rU   rV   r   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r<   r=   Úctc_lossñ   s~   $û
€ÿûÿù

ûÿ
r\   zraw_ops.CTCLossc	                 C   sð   |d u rd}t  |d¡}|d u rd}t  |d¡}|d u rd}t  |d¡}t  | g|tjtjgtj¡\}	\} t |tj¡}t |tj	¡}t |tj	¡}| |||g}
d|d|d|d|	f}t j
dd|
|||d	}t  ¡ rqt  d
|
||¡ t |¡}|S )NFrT   TrU   rV   r   s   CTCLossr   r?   rP   )r)   r+   rA   rB   rC   rD   r$   rE   Úint64rF   r   r.   r2   rY   r!   )r   rR   rS   r   rT   rU   rV   r   r   rG   r;   r:   r5   r<   r<   r=   rZ   Q  s8   "ýÿÿ
rZ   Ú	CTCLossV2c                 C   sŠ  t j pt  ¡ }|j}	|	jrbzt |d|| |||d|d|d|¡}
t |
¡}
|
W S  tj	y? } zt
 ||¡ W Y d}~nd}~w tjyH   Y nw zt| ||||||||d	W S  tjya   Y nw |du rhd}t |d¡}|du rtd}t |d¡}|du r€d}t |d¡}tjd| |||||||d		\}}}}|dd… }
t ¡ r¾d| d¡d| d¡d| d¡f}|j}t d|||
¡ t |
¡}
|
S )
a»  Calculates the CTC Loss (log probability) for each batch entry.  Also calculates

  the gradient.  This class performs the softmax operation for you, so inputs
  should be e.g. linear projections of outputs by an LSTM.

  Args:
    inputs: A `Tensor` of type `float32`.
      3-D, shape: `(max_time x batch_size x num_classes)`, the logits. Default blank
      label is 0 rather num_classes - 1.
    labels_indices: A `Tensor` of type `int64`.
      The indices of a `SparseTensor<int32, 2>`.
      `labels_indices(i, :) == [b, t]` means `labels_values(i)` stores the id for
      `(batch b, time t)`.
    labels_values: A `Tensor` of type `int32`.
      The values (labels) associated with the given batch and time.
    sequence_length: A `Tensor` of type `int32`.
      A vector containing sequence lengths (batch).
    preprocess_collapse_repeated: An optional `bool`. Defaults to `False`.
      Scalar, if true then repeated labels are
      collapsed prior to the CTC calculation.
    ctc_merge_repeated: An optional `bool`. Defaults to `True`.
      Scalar.  If set to false, *during* CTC calculation
      repeated non-blank labels will not be merged and are interpreted as
      individual labels.  This is a simplified version of CTC.
    ignore_longer_outputs_than_inputs: An optional `bool`. Defaults to `False`.
      Scalar. If set to true, during CTC
      calculation, items that have longer output sequences than input sequences
      are skipped: they don't contribute to the loss term and have zero-gradient.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (loss, gradient).

    loss: A `Tensor` of type `float32`.
    gradient: A `Tensor` of type `float32`.
  r^   rT   rU   rV   NrW   FTrX   )r   r   r   r   r   r   Ú_CTCLossV2Outputr!   r"   r#   r$   r%   r&   Úctc_loss_v2_eager_fallbackr(   r)   r+   r,   r-   r.   r0   r   r2   r[   r<   r<   r=   Úctc_loss_v2q  s|   %û
€ÿûÿù
üÿ
ra   zraw_ops.CTCLossV2c	                 C   sØ   |d u rd}t  |d¡}|d u rd}t  |d¡}|d u rd}t  |d¡}t | tj¡} t |tj¡}t |tj¡}t |tj¡}| |||g}	d|d|d|f}
t jdd|	|
||d}t  	¡ ret  
d	|	|
|¡ t |¡}|S )
NFrT   TrU   rV   s	   CTCLossV2r   r?   r^   )r)   r+   r$   rE   rB   rC   r]   rF   r   r.   r2   r_   r!   )r   rR   rS   r   rT   rU   rV   r   r   r;   r:   r5   r<   r<   r=   r`   Ñ  s6   þ
ÿÿ
r`   )TN)FrJ   N)FTFN)=Ú__doc__ÚcollectionsZtensorflow.pythonr   Ztensorflow.python.eagerr   r   r   r"   r   r)   Ztensorflow.python.frameworkr   rB   Ztensorflow.security.fuzzing.pyr   Z_atypesr   Z_op_def_registryr	   r$   r
   r,   Z"tensorflow.python.util.deprecationr   Ztensorflow.python.utilr   Ú	_dispatchZ tensorflow.python.util.tf_exportr   Útypingr   r   Ú
namedtupler    ZFloat32ZFloat64r   ZTensorFuzzingAnnotationZInt32ÚintÚboolr>   Z	to_raw_opr   r'   rL   rI   rN   rH   rM   rY   rQ   ZInt64r\   rP   rZ   r_   ra   r^   r`   r<   r<   r<   r=   Ú<module>   s\    þ.L,þ*H(þF]DþH]J