{"url":"https://htn20190109.hatenablog.com/entry/2026/05/03/142932","title":"Dropout\u30af\u30e9\u30b9","type":"rich","image_url":null,"version":"1.0","author_name":"HTN20190109","provider_name":"Hatena Blog","published":"2026-05-03 14:29:32","categories":["DL"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhtn20190109.hatenablog.com%2Fentry%2F2026%2F05%2F03%2F142932\" title=\"Dropout\u30af\u30e9\u30b9 - HTN20190109\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"import numpy as np class Dropout1: def __init__(self, dropout_ratio=0.5): self.dropout_ratio = dropout_ratio self.mask = None def forward(self, x, train_flg=True): if train_flg: self.mask = np.random.rand(*x.shape) > self.dropout_ratio return x * self.mask else: return x * (1.0 - self.dropout_ratio)\u2026","author_url":"https://blog.hatena.ne.jp/HTN20190109/","blog_url":"https://htn20190109.hatenablog.com/","height":"190","provider_url":"https://hatena.blog","width":"100%","blog_title":"HTN20190109\u306e\u65e5\u8a18"}