Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Tolerate Linear layers without bias parameters in profiler (#369)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #369

Handle `bias = None` as a registered parameter, as used in `Lienar(..., bias=False)`.

Reviewed By: mannatsingh

Differential Revision: D19700470

fbshipit-source-id: 286c1d40f1ead3d235ed5414aa72c7c8ff959e16
  • Loading branch information
edpizzi authored and facebook-github-bot committed Feb 4, 2020
1 parent a9a0855 commit dce1ef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classy_vision/generic/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _layer_flops(layer, x, _):
# linear layer:
elif layer_type in ["Linear"]:
weight_ops = layer.weight.numel()
bias_ops = layer.bias.numel()
bias_ops = layer.bias.numel() if layer.bias is not None else 0
return x.size()[0] * (weight_ops + bias_ops)

# 2D/3D batch normalization:
Expand Down

0 comments on commit dce1ef9

Please sign in to comment.