MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / __init__

Method __init__

python/oneflow/nn/utils/prune.py:279–289  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

277 """
278
279 def __init__(self, *args):
280 self._pruning_methods: Tuple["BasePruningMethod", ...] = tuple()
281 if not isinstance(args, Iterable): # only 1 item
282 self._tensor_name = args._tensor_name
283 self.add_pruning_method(args)
284 elif len(args) == 1: # only 1 item in a tuple
285 self._tensor_name = args[0]._tensor_name
286 self.add_pruning_method(args[0])
287 else: # manual construction from list or other iterable (or no args)
288 for method in args:
289 self.add_pruning_method(method)
290
291 def add_pruning_method(self, method):
292 r"""Adds a child pruning ``method`` to the container.

Callers

nothing calls this directly

Calls 2

add_pruning_methodMethod · 0.95
tupleClass · 0.85

Tested by

no test coverage detected