
    6biw                         S r SSKJs  Jr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  \" S5       " S	 S
\5      5       rg)z%Keras upsampling layer for 3D inputs.    N)backend)Layer)	InputSpec)
conv_utils)keras_exportzkeras.layers.UpSampling3Dc                   H   ^  \ rS rSrSrSU 4S jjrS rS rU 4S jrSr	U =r
$ )	UpSampling3D   a  Upsampling layer for 3D inputs.

Repeats the 1st, 2nd and 3rd dimensions
of the data by `size[0]`, `size[1]` and `size[2]` respectively.

Examples:

>>> input_shape = (2, 1, 2, 1, 3)
>>> x = tf.constant(1, shape=input_shape)
>>> y = tf.keras.layers.UpSampling3D(size=2)(x)
>>> print(y.shape)
(2, 2, 4, 2, 3)

Args:
  size: Int, or tuple of 3 integers.
    The upsampling factors for dim1, dim2 and dim3.
  data_format: A string,
    one of `channels_last` (default) or `channels_first`.
    The ordering of the dimensions in the inputs.
    `channels_last` corresponds to inputs with shape
    `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
    while `channels_first` corresponds to inputs with shape
    `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
    When unspecified, uses
    `image_data_format` value found in your TF-Keras config file at
     `~/.keras/keras.json` (if exists) else 'channels_last'.
    Defaults to 'channels_last'.

Input shape:
  5D tensor with shape:
  - If `data_format` is `"channels_last"`:
      `(batch_size, dim1, dim2, dim3, channels)`
  - If `data_format` is `"channels_first"`:
      `(batch_size, channels, dim1, dim2, dim3)`

Output shape:
  5D tensor with shape:
  - If `data_format` is `"channels_last"`:
      `(batch_size, upsampled_dim1, upsampled_dim2, upsampled_dim3,
      channels)`
  - If `data_format` is `"channels_first"`:
      `(batch_size, channels, upsampled_dim1, upsampled_dim2,
      upsampled_dim3)`
c                    > [         R                  " U5      U l        [         R                  " USS5      U l        [        SS9U l        [        TU ]   " S0 UD6  g )N   size   )ndim )	r   normalize_data_formatdata_formatnormalize_tupler   r   
input_specsuper__init__)selfr   r   kwargs	__class__s       e/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/layers/reshaping/up_sampling3d.pyr   UpSampling3D.__init__L   sH    %;;KH..tQ?	#+"6"    c                 D   [         R                  " U5      R                  5       nU R                  S:X  aw  US   b  U R                  S   US   -  OS nUS   b  U R                  S   US   -  OS nUS   b  U R                  S   US   -  OS n[         R                  " US   US   X#U/5      $ US   b  U R                  S   US   -  OS nUS   b  U R                  S   US   -  OS nUS   b  U R                  S   US   -  OS n[         R                  " US   X#XAS   /5      $ )Nchannels_first   r   r         )tfTensorShapeas_listr   r   )r   input_shapedim1dim2dim3s        r   compute_output_shape!UpSampling3D.compute_output_shapeR   sp   nn[199;// q>- 		!{1~-  q>- 		!{1~-  q>- 		!{1~- 
 >>QQTB  q>- 		!{1~-  q>- 		!{1~-  q>- 		!{1~- 
 >>QTq>B r   c                     [         R                  " XR                  S   U R                  S   U R                  S   U R                  5      $ )Nr   r    r   )r   resize_volumesr   r   )r   inputss     r   callUpSampling3D.call{   s<    %%IIaL$))A,		!d>N>N
 	
r   c                    > U R                   U R                  S.n[        TU ]  5       n[	        [        UR                  5       5      [        UR                  5       5      -   5      $ )N)r   r   )r   r   r   
get_configdictlistitems)r   configbase_configr   s      r   r1   UpSampling3D.get_config   sM    ))D4D4DEg(*D**,-V\\^0DDEEr   )r   r   r   ))r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r)   r.   r1   __static_attributes____classcell__)r   s   @r   r	   r	      s%    +Z#'R

F Fr   r	   )r<   tensorflow.compat.v2compatv2r"   tf_keras.srcr   tf_keras.src.engine.base_layerr   tf_keras.src.engine.input_specr   tf_keras.src.utilsr    tensorflow.python.util.tf_exportr   r	   r   r   r   <module>rG      sJ    , " !   0 4 ) : )*eF5 eF +eFr   