https://blog.csdn.net/weixin_41036461/article/details/80900616
可以参考:
https://blog.csdn.net/u010167269/article/details/51966427
待学习:
import torch
import numpy as np
class Dropout:
"""
http://arxiv.org/abs/1207.0580
"""
def __init__(self, dropout_ratio=0.5):
self.dropout_ratio = dropout_ratio
self.train_flg = True
self.mask = None
def __call__(self, x, manual_mask=None, train_flg=True):
if train_flg:
if manual_mask is None