def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "RNNBase", [ "mode", "input_size", "hidden_size", "num_layers", "bias", "batch_first", "dropout", "bidirectional", ], ) self.params = self.template_fn( mode=Param(name="mode", default=None), input_size=IntParam(name="input_size", default=1), hidden_size=Param(name="hidden_size", default=None), num_layers=IntParam(name="num_layers", default=1), bias=BinaryParam(name="bias", default=True, true_prob=0.5), batch_first=BinaryParam(name="batch_first", default=False, true_prob=0.5), dropout=IntParam(name="dropout", default=0.0), bidirectional=BinaryParam(name="bidirectional", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "EmbeddingBag", [ "num_embeddings", "embedding_dim", "max_norm", "norm_type", "scale_grad_by_freq", "mode", "sparse", "_weight", ], ) self.params = self.template_fn( num_embeddings=IntParam(name="num_embeddings", default=1), embedding_dim=IntParam(name="embedding_dim", default=1), max_norm=Param(name="max_norm", default=None), norm_type=IntParam(name="norm_type", default=2.0), scale_grad_by_freq=BinaryParam(name="scale_grad_by_freq", default=False, true_prob=0.5), mode=ChoiceParam(name="mode", choices=("mean", ), cprobs=(1, ), default="mean"), sparse=BinaryParam(name="sparse", default=False, true_prob=0.5), _weight=Param(name="_weight", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "FractionalMaxPool3d", [ "kernel_size", "output_size", "output_ratio", "return_indices", "_random_samples", ], ) self.params = self.template_fn( kernel_size=TupleParam( name="kernel_size", size=3, limits=((1, 1, 1), (1, 1, 1)), default=(1, 1, 1), ), output_size=TupleParam(name="output_size", size=3, default=(1, 1, 1)), output_ratio=Param(name="output_ratio", default=None), return_indices=BinaryParam(name="return_indices", default=False, true_prob=0.5), _random_samples=Param(name="_random_samples", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "SyncBatchNorm", [ "num_features", "eps", "momentum", "affine", "track_running_stats", "process_group", ], ) self.params = self.template_fn( num_features=Param(name="num_features", default=None), eps=FloatParam(name="eps", default=1e-05), momentum=FloatParam(name="momentum", default=0.1), affine=BinaryParam(name="affine", default=False, true_prob=0.5), track_running_stats=BinaryParam(name="track_running_stats", default=False, true_prob=0.5), process_group=Param(name="process_group", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "MultiheadAttention", [ "embed_dim", "num_heads", "dropout", "bias", "add_bias_kv", "add_zero_attn", "kdim", "vdim", ], ) self.params = self.template_fn( embed_dim=Param(name="embed_dim", default=None), num_heads=Param(name="num_heads", default=None), dropout=IntParam(name="dropout", default=0.0), bias=BinaryParam(name="bias", default=True, true_prob=0.5), add_bias_kv=BinaryParam(name="add_bias_kv", default=False, true_prob=0.5), add_zero_attn=BinaryParam(name="add_zero_attn", default=False, true_prob=0.5), kdim=Param(name="kdim", default=None), vdim=Param(name="vdim", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("Threshold", ["threshold", "value", "inplace"]) self.params = self.template_fn( threshold=Param(name="threshold", default=None), value=Param(name="value", default=None), inplace=BinaryParam(name="inplace", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("TransformerEncoder", ['encoder_layer', 'num_layers', 'norm']) self.params = self.template_fn( encoder_layer=Param(name="encoder_layer", default=None), num_layers=Param(name="num_layers", default=None), norm=Param(name="norm", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "RNNCellBase", ["input_size", "hidden_size", "bias", "num_chunks"]) self.params = self.template_fn( input_size=IntParam(name="input_size", default=1), hidden_size=Param(name="hidden_size", default=None), bias=Param(name="bias", default=None), num_chunks=Param(name="num_chunks", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "GroupNorm", ["num_groups", "num_channels", "eps", "affine"]) self.params = self.template_fn( num_groups=Param(name="num_groups", default=None), num_channels=Param(name="num_channels", default=None), eps=FloatParam(name="eps", default=1e-05), affine=BinaryParam(name="affine", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "Hardtanh", ["min_val", "max_val", "inplace", "min_value", "max_value"]) self.params = self.template_fn( min_val=IntParam(name="min_val", default=-1.0), max_val=IntParam(name="max_val", default=1.0), inplace=BinaryParam(name="inplace", default=False, true_prob=0.5), min_value=Param(name="min_value", default=None), max_value=Param(name="max_value", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("MultiLabelMarginLoss", ["size_average", "reduce", "reduction"]) self.params = self.template_fn( size_average=Param(name="size_average", default=None), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "Upsample", ["size", "scale_factor", "mode", "align_corners"]) self.params = self.template_fn( size=Param(name="size", default=None), scale_factor=IntParam(name="scale_factor", default=1), mode=ChoiceParam(name="mode", choices=("nearest", ), cprobs=(1, ), default="nearest"), align_corners=Param(name="align_corners", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "AdaptiveLogSoftmaxWithLoss", ["in_features", "n_classes", "cutoffs", "div_value", "head_bias"], ) self.params = self.template_fn( in_features=IntParam(name="in_features", default=1), n_classes=Param(name="n_classes", default=None), cutoffs=Param(name="cutoffs", default=None), div_value=IntParam(name="div_value", default=4.0), head_bias=BinaryParam(name="head_bias", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "CosineEmbeddingLoss", ["margin", "size_average", "reduce", "reduction"]) self.params = self.template_fn( margin=IntParam(name="margin", default=0.0), size_average=Param(name="size_average", default=None), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "TransformerDecoderLayer", ['d_model', 'nhead', 'dim_feedforward', 'dropout', 'activation']) self.params = self.template_fn( d_model=Param(name="d_model", default=None), nhead=Param(name="nhead", default=None), dim_feedforward=IntParam(name="dim_feedforward", default=2048), dropout=FloatParam(name="dropout", default=0.1), activation=ChoiceParam(name="activation", choices=("relu", ), cprobs=(1, ), default="relu"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "NLLLoss", ["weight", "size_average", "ignore_index", "reduce", "reduction"]) self.params = self.template_fn( weight=Param(name="weight", default=None), size_average=Param(name="size_average", default=None), ignore_index=IntParam(name="ignore_index", default=-100), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "BCEWithLogitsLoss", ["weight", "size_average", "reduce", "reduction", "pos_weight"], ) self.params = self.template_fn( weight=Param(name="weight", default=None), size_average=Param(name="size_average", default=None), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), pos_weight=Param(name="pos_weight", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "MultiMarginLoss", ["p", "margin", "weight", "size_average", "reduce", "reduction"], ) self.params = self.template_fn( p=IntParam(name="p", default=1), margin=IntParam(name="margin", default=1.0), weight=Param(name="weight", default=None), size_average=Param(name="size_average", default=None), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("UpsamplingBilinear2d", ["size", "scale_factor"]) self.params = self.template_fn( size=Param(name="size", default=None), scale_factor=IntParam(name="scale_factor", default=1), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("GRUCell", ["input_size", "hidden_size", "bias"]) self.params = self.template_fn( input_size=IntParam(name="input_size", default=1), hidden_size=Param(name="hidden_size", default=None), bias=BinaryParam(name="bias", default=True, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "Unfold", ["kernel_size", "dilation", "padding", "stride"]) self.params = self.template_fn( kernel_size=Param(name="kernel_size", default=None), dilation=IntParam(name="dilation", default=1), padding=IntParam(name="padding", default=0), stride=IntParam(name="stride", default=1), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("CrossMapLRN2d", ["size", "alpha", "beta", "k"]) self.params = self.template_fn( size=Param(name="size", default=None), alpha=FloatParam(name="alpha", default=0.0001), beta=FloatParam(name="beta", default=0.75), k=IntParam(name="k", default=1), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "LayerNorm", ["normalized_shape", "eps", "elementwise_affine"]) self.params = self.template_fn( normalized_shape=Param(name="normalized_shape", default=None), eps=FloatParam(name="eps", default=1e-05), elementwise_affine=BinaryParam(name="elementwise_affine", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "TripletMarginLoss", [ "margin", "p", "eps", "swap", "size_average", "reduce", "reduction" ], ) self.params = self.template_fn( margin=IntParam(name="margin", default=1.0), p=IntParam(name="p", default=2.0), eps=FloatParam(name="eps", default=1e-06), swap=BinaryParam(name="swap", default=False, true_prob=0.5), size_average=Param(name="size_average", default=None), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "PoissonNLLLoss", [ "log_input", "full", "size_average", "eps", "reduce", "reduction" ], ) self.params = self.template_fn( log_input=BinaryParam(name="log_input", default=True, true_prob=0.5), full=BinaryParam(name="full", default=False, true_prob=0.5), size_average=Param(name="size_average", default=None), eps=FloatParam(name="eps", default=1e-08), reduce=Param(name="reduce", default=None), reduction=ChoiceParam(name="reduction", choices=("mean", ), cprobs=(1, ), default="mean"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "RNNCell", ["input_size", "hidden_size", "bias", "nonlinearity"]) self.params = self.template_fn( input_size=IntParam(name="input_size", default=1), hidden_size=Param(name="hidden_size", default=None), bias=BinaryParam(name="bias", default=True, true_prob=0.5), nonlinearity=ChoiceParam(name="nonlinearity", choices=("tanh", ), cprobs=(1, ), default="tanh"), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "LPPool2d", ["norm_type", "kernel_size", "stride", "ceil_mode"]) self.params = self.template_fn( norm_type=Param(name="norm_type", default=None), kernel_size=TupleParam(name="kernel_size", size=2, limits=((1, 1), (1, 1)), default=(1, 1)), stride=TupleParam(name="stride", size=2, limits=((1, 1), (1, 1)), default=(1, 1)), ceil_mode=BinaryParam(name="ceil_mode", default=False, true_prob=0.5), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple( "AvgPool3d", [ "kernel_size", "stride", "padding", "ceil_mode", "count_include_pad", "divisor_override", ], ) self.params = self.template_fn( kernel_size=TupleParam( name="kernel_size", size=3, limits=((1, 1, 1), (1, 1, 1)), default=(1, 1, 1), ), stride=TupleParam(name="stride", size=3, limits=((1, 1, 1), (1, 1, 1)), default=(1, 1, 1)), padding=TupleParam(name="padding", size=3, limits=((0, 0, 0), (0, 0, 0)), default=(0, 0, 0)), ceil_mode=BinaryParam(name="ceil_mode", default=False, true_prob=0.5), count_include_pad=BinaryParam(name="count_include_pad", default=True, true_prob=0.5), divisor_override=Param(name="divisor_override", default=None), ) for k, v in kwargs.items(): getattr(self.params, k).val = v
def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("LogSoftmax", ["dim"]) self.params = self.template_fn(dim=Param(name="dim", default=None)) for k, v in kwargs.items(): getattr(self.params, k).val = v