Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def linear_layer(input_dim: int, output_dim: int, p: float, idx: int):
if params is not None:
return MAMLLinear(
weight=params[f'ffn.{idx}.weight'],
bias=params[f'ffn.{idx}.bias'])
return nn.Linear(input_dim, output_dim)
def __init__(self, weight, bias):
super(MAMLLinear, self).__init__()
self.weight = nn.Parameter(weight)
self.bias = nn.Parameter(bias)