o
    ®?eń	  ć                   @   sf   d Z ddlZddl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d	ZdS )z,Utility ops shared across tf.contrib.signal.é    N)Śops)Śtensor_util)Ś	array_ops)Śmath_ops)Ś
while_loopc                 C   s  t  |d| |g”y t  | ”} t  |”}| j d” |j d” | jjs+td| j |jjs6td|j t 	| ”}t 	|”}|durd|durdt
jjdk rRtj}ntj}t  |||”W  d   S dd }d	d }tj||| |gd
d\} }| W  d   S 1 sw   Y  dS )az  Returns the greatest common divisor via Euclid's algorithm.

  Args:
    a: The dividend. A scalar integer `Tensor`.
    b: The divisor. A scalar integer `Tensor`.
    name: An optional name for the operation.

  Returns:
    A scalar `Tensor` representing the greatest common divisor between `a` and
    `b`.

  Raises:
    ValueError: If `a` or `b` are not scalar integers.
  Śgcdr   z"a must be an integer type. Got: %sz"b must be an integer type. Got: %sNé   c                 S   s   t  |t |””S ©N)r   Zgreaterr   Z
zeros_like)Ś_Śb© r   śf/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/ops/signal/util_ops.pyŚ<lambda>B   s    zgcd.<locals>.<lambda>c                 S   s   |t  | |”gS r	   )r   Śmod)Śar   r   r   r   r   C   s    F)Z	back_prop)r   Z
name_scopeZconvert_to_tensorŚshapeZassert_has_rankZdtypeŚ
is_integerŚ
ValueErrorr   Zconstant_valueŚsysŚversion_infoŚmajorŚ	fractionsr   Śmathr   )r   r   ŚnameZconst_aZconst_bZmath_gcdZcondŚbodyr   r   r   r      s,   



ė$ęr   r	   )Ś__doc__r   r   r   Ztensorflow.python.frameworkr   r   Ztensorflow.python.opsr   r   r   r   r   r   r   r   Ś<module>   s   