Skip to content

Commit

Permalink
feat: add parameter getters
Browse files Browse the repository at this point in the history
  • Loading branch information
julianhoever committed Sep 9, 2023
1 parent 924e5f3 commit 3c184c0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions elasticai/creator/nn/fixed_point/linear/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ def __init__(
device=device,
)

@property
def lin_weight(self) -> torch.Tensor:
return self._linear.weight

@property
def lin_bias(self) -> torch.Tensor | None:
return self._linear.bias

@property
def bn_weight(self) -> torch.Tensor:
return self._batch_norm.weight

@property
def bn_bias(self) -> torch.Tensor:
return self._batch_norm.bias

def forward(self, x: torch.Tensor) -> torch.Tensor:
has_batches = x.dim() == 2
input_shape = x.shape if has_batches else (1, -1)
Expand Down

0 comments on commit 3c184c0

Please sign in to comment.