
    BVh                     ^    d Z ddlmZ ddlmZ ddlmZ ddlmZ dej                  fdZd Zy)	zHelpers constructing Datasets.    )constant_op)dtypes)ops)tensor_shapec                 f    |t        j                  |||       S t        j                  |||       S )N)dtypename)r   convert_to_tensorr   constant)argument_nameargument_valueargument_defaultargument_dtypes       S/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/data/util/convert.pyoptional_param_to_tensorr      sD       n=B B ]D D    c                    	 t        j                  |       } t        j                  | j	                         D cg c]  }||nd
 c}t
        j                        S c c}w # t        t        f$ r t        j                  | t
        j                        }|j                  j                  Gt        |j                  j                        dk7  r%t        dj                  | |j                              |j                  t
        j                  k7  r/t        dj                  | |j                  j                              |cY S w xY w)a/  Returns a `tf.Tensor` that represents the given shape.

  Args:
    shape_like: A value that can be converted to a `tf.TensorShape` or a
      `tf.Tensor`.

  Returns:
    A 1-D `tf.Tensor` of `tf.int64` elements representing the given shape, where
    `-1` is substituted for any unknown dimensions.
  )r   )preferred_dtype   zSThe given shape {} must be a 1-D tensor of `tf.int64` values, but the shape was {}.zZThe given shape {} must be a 1-D tensor of `tf.int64` values, but the element type was {}.)r   as_shaper   r
   as_listr   int64	TypeError
ValueErrorshapedimslenformatr   r	   )
shape_likedimrets      r   partial_shape_to_tensorr#   "   s    &&z2J  3=3E3E3GHCR	'Hll H
Z	   


FLL
IC
yy~~!c#))..&9Q&> 77=v%syy823 3 yyFLL  ==CV$ciinn>67 7 Js#   6A! AA! A! !CEEN)	__doc__tensorflow.python.frameworkr   r   r   r   r   r   r#    r   r   <module>r'      s-    % 3 . + 4
 /0,2LL	D!r   