Back to Annotated Deep Learning Paper Implementations

උෂ්ණත්වයසමඟ භාෂා ආකෘති වලින් නියැදීම

docs/si/sampling/temperature.html

latest1.8 KB
Original Source

homesampling

View code on Github

#

උෂ්ණත්වයසමඟ භාෂා ආකෘති වලින් නියැදීම

මෙන්නඅපි පහත සඳහන් සම්භාවිතා ව්යාප්තියෙන් නියැදිය, u1:∣V∣​ වාග් මාලාව කොහෙද V , බෙදා හැරීමේ පිවිසුම් සහ T යනු උෂ්ණත්වය:

P(xi​=Vl​∣x1:i−1​)=∑j​exp(Tuj​​)exp(Tul​​)​

T=1 සාමාන්ය අහඹු නියැදීම් වේ.

මෙන්නමෙම නියැදි ශිල්පීය ක්රම භාවිතා කරන අත්හදා බැලීමක් .

19importtorch20fromtorch.distributionsimportCategorical2122fromlabml\_nn.samplingimportSampler

#

උෂ්ණත්වයසමඟ නියැදිකරු

25classTemperatureSampler(Sampler):

#

  • temperature සමඟ නියැදිය යුතු උෂ්ණත්වය වේ
29def\_\_init\_\_(self,temperature:float=1.0):

#

33self.temperature=temperature

#

පිවිසුම්වලින් නියැදිය

35def\_\_call\_\_(self,logits:torch.Tensor):

#

උෂ්ණත්වගැලපුම් පිවිසුම් සමඟ වර්ගීකරණ බෙදාහැරීමක් සාදන්න

41dist=Categorical(logits=logits/self.temperature)

#

නියැදිය

44returndist.sample()

Trending Research Paperslabml.ai