Skip to content

Commit 37a787a

Browse files
authored
Add docstring for the AutoencoderKL's decode (huggingface#5242)
* Add docstring for the AutoencoderKL's decode huggingface#5230 * Follow the style guidelines in AutoencoderKL's decode huggingface#5230 --------- Co-authored-by: stano <>
1 parent d56825e commit 37a787a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/diffusers/models/autoencoder_kl.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,20 @@ def _decode(self, z: torch.FloatTensor, return_dict: bool = True) -> Union[Decod
281281

282282
@apply_forward_hook
283283
def decode(self, z: torch.FloatTensor, return_dict: bool = True) -> Union[DecoderOutput, torch.FloatTensor]:
284+
"""
285+
Decode a batch of images.
286+
287+
Args:
288+
z (`torch.FloatTensor`): Input batch of latent vectors.
289+
return_dict (`bool`, *optional*, defaults to `True`):
290+
Whether to return a [`~models.vae.DecoderOutput`] instead of a plain tuple.
291+
292+
Returns:
293+
[`~models.vae.DecoderOutput`] or `tuple`:
294+
If return_dict is True, a [`~models.vae.DecoderOutput`] is returned, otherwise a plain `tuple` is
295+
returned.
296+
297+
"""
284298
if self.use_slicing and z.shape[0] > 1:
285299
decoded_slices = [self._decode(z_slice).sample for z_slice in z.split(1)]
286300
decoded = torch.cat(decoded_slices)

0 commit comments

Comments
 (0)