MCPcopy Create free account
hub / github.com/AlayaLab/Hive / forward

Method forward

models/flowsep/diffusers/models/vq_model.py:144–158  ·  view source on GitHub ↗

r""" Args: sample (`torch.FloatTensor`): Input sample. return_dict (`bool`, *optional*, defaults to `True`): Whether or not to return a [`DecoderOutput`] instead of a plain tuple.

(self, sample: torch.FloatTensor, return_dict: bool = True)

Source from the content-addressed store, hash-verified

142 return DecoderOutput(sample=dec)
143
144 def forward(self, sample: torch.FloatTensor, return_dict: bool = True) -> Union[DecoderOutput, torch.FloatTensor]:
145 r"""
146 Args:
147 sample (`torch.FloatTensor`): Input sample.
148 return_dict (`bool`, *optional*, defaults to `True`):
149 Whether or not to return a [`DecoderOutput`] instead of a plain tuple.
150 """
151 x = sample
152 h = self.encode(x).latents
153 dec = self.decode(h).sample
154
155 if not return_dict:
156 return (dec,)
157
158 return DecoderOutput(sample=dec)

Callers

nothing calls this directly

Calls 3

encodeMethod · 0.95
decodeMethod · 0.95
DecoderOutputClass · 0.85

Tested by

no test coverage detected