
    AVh&7                        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 m!Z! ddl"m#Z#  ejH                  dddg      Z%ejL                  ejN                   ed      dde#e!ejP                  f   de)de)de)de*f
d                     Z+  ed       ejX                  e+            Z-e+j\                  j^                  Z0de#e!ejP                  f   de)de)de)de*f
dZ1y)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Any)	AnnotatedDecodeProtoV2sizesvalueszio.decode_protobytesmessage_typedescriptor_sourcemessage_formatsanitizec                    t         j                   xs t        j                         }|j                  }	|	j                  r<	 t	        j
                  |d|| d|d|d|d|d|d|      }
t        j                  |
      }
|
S t        | |||||||fd      }
|
t        ur|
S t3        j4                  |d      }t7        |t8        t:        f      st#        d|z        |D cg c]  }t3        j4                  |d       }}t7        |t8        t:        f      st#        d|z        |D cg c]  }t3        j<                  |d       }}|d}t3        j4                  |d      }|d}t3        j4                  |d      }|d}t3        j>                  |d      }	 tA        jB                  d| |||||||	      \  }}}}|dd }
t3        jD                         rd|jG                  d      d|jG                  d      d|jG                  d      d|jG                  d      d|jG                  d      d|jI                  d      f}|jJ                  }t3        jL                  d|||
       |
dd |
dd gz   }
t        j                  |
      }
|
S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||fd      }
|
t        ur|
S t        | ||||||||		      S # t        j                   $ r Y qt"        t$        f$ rN t'        j(                  t*        d
t-        | |||||||            }
|
t&        j.                  j0                  ur|
cY S  w xY wc c}w c c}w # t"        t$        f$ rN t'        j(                  t*        d
t-        | |||||||            }
|
t&        j.                  j0                  ur|
cY S  w xY w)a  The op extracts fields from a serialized protocol buffers message into tensors.

  Note: This API is designed for orthogonality rather than human-friendliness. It
  can be used to parse input protos by hand, but it is intended for use in
  generated code.

  The `decode_proto` op extracts fields from a serialized protocol buffers
  message into tensors.  The fields in `field_names` are decoded and converted
  to the corresponding `output_types` if possible.

  A `message_type` name must be provided to give context for the field names.
  The actual message descriptor can be looked up either in the linked-in
  descriptor pool or a filename provided by the caller using the
  `descriptor_source` attribute.

  Each output tensor is a dense tensor. This means that it is padded to hold
  the largest number of repeated elements seen in the input minibatch. (The
  shape is also padded by one to prevent zero-sized dimensions). The actual
  repeat counts for each example in the minibatch can be found in the `sizes`
  output. In many cases the output of `decode_proto` is fed immediately into
  tf.squeeze if missing values are not a concern. When using tf.squeeze, always
  pass the squeeze dimension explicitly to avoid surprises.

  For the most part, the mapping between Proto field types and TensorFlow dtypes
  is straightforward. However, there are a few special cases:

  - A proto field that contains a submessage or group can only be converted
  to `DT_STRING` (the serialized submessage). This is to reduce the complexity
  of the API. The resulting string can be used as input to another instance of
  the decode_proto op.

  - TensorFlow lacks support for unsigned integers. The ops represent uint64
  types as a `DT_INT64` with the same twos-complement bit pattern (the obvious
  way). Unsigned int32 values can be represented exactly by specifying type
  `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in
  the `output_types` attribute.

  - `map` fields are not directly decoded. They are treated as `repeated` fields,
  of the appropriate entry type. The proto-compiler defines entry types for each
  map field. The type-name is the field name, converted to "CamelCase" with
  "Entry" appended. The `tf.train.Features.FeatureEntry` message is an example of
  one of these implicit `Entry` types.

  - `enum` fields should be read as int32.

  Both binary and text proto serializations are supported, and can be
  chosen using the `format` attribute.

  The `descriptor_source` attribute selects the source of protocol
  descriptors to consult when looking up `message_type`. This may be:

  - An empty string  or "local://", in which case protocol descriptors are
  created for C++ (not Python) proto definitions linked to the binary.

  - A file, in which case protocol descriptors are created from the file,
  which is expected to contain a `FileDescriptorSet` serialized as a string.
  NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out`
  and `--include_imports` options to the protocol compiler `protoc`.

  - A "bytes://<bytes>", in which protocol descriptors are created from `<bytes>`,
  which is expected to be a `FileDescriptorSet` serialized as a string.

  Here is an example:

  The, internal, `Summary.Value` proto contains a
  `oneof {float simple_value; Image image; ...}`

  >>> from google.protobuf import text_format
  >>>
  >>> # A Summary.Value contains: oneof {float simple_value; Image image}
  >>> values = [
  ...    "simple_value: 2.2",
  ...    "simple_value: 1.2",
  ...    "image { height: 128 width: 512 }",
  ...    "image { height: 256 width: 256 }",]
  >>> values = [
  ...    text_format.Parse(v, tf.compat.v1.Summary.Value()).SerializeToString()
  ...    for v in values]

  The following can decode both fields from the serialized strings:

  >>> sizes, [simple_value, image]  = tf.io.decode_proto(
  ...  values,
  ...  tf.compat.v1.Summary.Value.DESCRIPTOR.full_name,
  ...  field_names=['simple_value', 'image'],
  ...  output_types=[tf.float32, tf.string])

  The `sizes` has the same shape as the input, with an additional axis across the
  fields that were decoded. Here the first column of `sizes` is the size of the
  decoded `simple_value` field:

  >>> print(sizes)
  tf.Tensor(
  [[1 0]
   [1 0]
   [0 1]
   [0 1]], shape=(4, 2), dtype=int32)

  The result tensors each have one more index than the input byte-strings.
  The valid elements of each result tensor are indicated by
  the appropriate column of `sizes`. The invalid elements are padded with a
  default value:

  >>> print(simple_value)
  tf.Tensor(
  [[2.2]
   [1.2]
   [0. ]
   [0. ]], shape=(4, 1), dtype=float32)

  Nested protos are extracted as string tensors:

  >>> print(image.dtype)
  <dtype: 'string'>
  >>> print(image.shape.as_list())
  [4, 1]

  To convert to a `tf.RaggedTensor` representation use:

  >>> tf.RaggedTensor.from_tensor(simple_value, lengths=sizes[:, 0]).to_list()
  [[2.2], [1.2], [], []]

  Args:
    bytes: A `Tensor` of type `string`.
      Tensor of serialized protos with shape `batch_shape`.
    message_type: A `string`. Name of the proto message type to decode.
    field_names: A list of `strings`.
      List of strings containing proto field names. An extension field can be decoded
      by using its full name, e.g. EXT_PACKAGE.EXT_FIELD_NAME.
    output_types: A list of `tf.DTypes`.
      List of TF types to use for the respective field in field_names.
    descriptor_source: An optional `string`. Defaults to `"local://"`.
      Either the special value `local://` or a path to a file containing
      a serialized `FileDescriptorSet`.
    message_format: An optional `string`. Defaults to `"binary"`.
      Either `binary` or `text`.
    sanitize: An optional `bool`. Defaults to `False`.
      Whether to sanitize the result or not.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sizes, values).

    sizes: A `Tensor` of type `int32`.
    values: A list of `Tensor` objects of type `output_types`.
  r   r   field_namesoutput_typesr   r   r   N)r   r   r   r   r   r   namectx )r   r   r   r   r   r   r   r   IExpected list for 'field_names' argument to 'decode_proto_v2' Op, not %r.JExpected list for 'output_types' argument to 'decode_proto_v2' Op, not %r.local://binaryF   )'_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_DecodeProtoV2Output_make_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException_dispatcher_for_decode_proto_v2NotImplementeddecode_proto_v2_eager_fallback_SymbolicException	TypeError
ValueError	_dispatchr   decode_proto_v2dictOpDispatcherNOT_SUPPORTED_executemake_str
isinstancelisttuple	make_type	make_bool_op_def_library_apply_op_helpermust_record_gradientget_attr_get_attr_boolinputsrecord_gradient)r   r   r   r   r   r   r   r   _ctxtld_resulte_s_t__op_outputs_attrs_inputs_flats                      Z/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_decode_proto_ops.pyr8   r8      s<   l 
			0h..0$#\\11otUNL{NL.0@
H	.g
 %**73gn> .	k<9J$	)*.0G n$n""<@,	K$	/
	(*5	67 7 ALL"""2}5L+L	L4-	0
	(*6	78 8 DPPR($$R8P,P"''(9;NON$$^5EF.H*5(
)::u<%0|+<(6"$Aq#x$ QK'""$cll>:Mll=)>ll>*,?ll./1All+,j  ,.F ::Lvw8BQK712;-'' &&w/'	.q && -
##At,,## 
/,\;L
(D+,02g 
	&+
l#7H'(	 
 ## 
z" ""RE2=3?8I5C/7d"Dg 
	..<<	<0 M
 Q" Z	  
  
2t%l0;1=6G3A-5D B
G i,,:::n	
s\    :I7 M)M.#M3 7J>
J%%J>=J>K4  K4 4M&
AM&$M&3AOOzraw_ops.DecodeProtoV2c	                 P   t        j                  |d      }t        |t        t        f      st        d|z        |D 	cg c]  }	t        j                  |	d       }}	t        |t        t        f      st        d|z        |D 
cg c]  }
t        j                  |
d       }}
|d}t        j                  |d      }|d}t        j                  |d	      }|d
}t        j                  |d      }t        j                  | t        j                        } | g}d|d|d|d|d	|d|f}t        j                  dt        |      dz   ||||      }t        j                         rt        j                  d|||       |d d |dd  gz   }t         j#                  |      }|S c c}	w c c}
w )Nr   r!   r   r"   r   r#   r   r$   r   Fr   s   DecodeProtoV2r%   )rH   attrsr   r   r   )r<   r=   r>   r?   r@   r5   rA   rB   r.   convert_to_tensor_dtypesstringr   lenrE   rI   r*   r+   )r   r   r   r   r   r   r   r   r   rN   rO   rT   rS   rL   s                 rU   r3   r3     s   ""<@,	K$	/
	(*5	67 7 ALL"""2}5L+L	L4-	0
	(*6	78 8 DPPR($$R8P,P"''(9;NON$$^5EF.H*5(

 
 
7%,L-, 35FNJ:& -s</@1/D$0C"&(' ""$vw8BQK712;-'' &&w/'	.9 M
 Qs   FF#)r#   r$   FN)2__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r&   r   r,   r   r<   tensorflow.python.frameworkr   rY   tensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   r.   r   rC   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   r7    tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   
namedtupler*   add_fallback_dispatch_listadd_type_based_api_dispatcherStringstrboolr8   	to_raw_opr   _tf_type_based_dispatcherDispatchr1   r3   r        rU   <module>rs      sK  
  6 7 1 7 9 F K 3 I C 8 6 % % '-{--h 
 %%
((
v9S'..%89 v v{~ v  [^ v  rv v  ) &vp 3	12>4>>/3RS"1"K"K"T"T ")C4G*H "X[ "  LO "  ad "  pt "rr   