MCPcopy Create free account
hub / github.com/SLDGroup/MERIT / CalParams

Function CalParams

utils/utils.py:75–88  ·  view source on GitHub ↗

Usage: Calculate Params and FLOPs via [THOP](https://github.com/Lyken17/pytorch-OpCounter) Necessarity: from thop import profile from thop import clever_format :param model: :param input_tensor: :return:

(model, input_tensor)

Source from the content-addressed store, hash-verified

73
74
75def CalParams(model, input_tensor):
76 """
77 Usage:
78 Calculate Params and FLOPs via [THOP](https://github.com/Lyken17/pytorch-OpCounter)
79 Necessarity:
80 from thop import profile
81 from thop import clever_format
82 :param model:
83 :param input_tensor:
84 :return:
85 """
86 flops, params = profile(model, inputs=(input_tensor,))
87 flops, params = clever_format([flops, params], "%.3f")
88 print('[Statistics Information]\nFLOPs: {}\nParams: {}'.format(flops, params))
89
90def one_hot_encoder(input_tensor,dataset,n_classes = None):
91 tensor_list = []

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected