20ca9d882e448df5f1a9c5c0d74772763651826a,thinc/model.py,Model,use_params,#Model#Any#,296

Before Change


            param = params[self.id]
            backup = weights.copy()
            copy_array(dst=weights, src=param)
        contexts = []
        for layer in self.layers:
            contexts.append(next(layer.use_params(params).gen))
        for shim in self.shims:
            contexts.append(next(shim.use_params(params).gen))
        yield
        if backup is not None:
            copy_array(dst=self._mem.weights, src=backup)
        for i, context in enumerate(contexts):
            // This is ridiculous, but apparently it"s what you
            // have to do to make this work across Python 2/3?
            try:
                next(context.gen)
            except StopIteration:
                pass

    def walk(self) -> Iterable["Model"]:
        Iterate out layers of the model, breadth-first.
        queue = [self]
        seen: Set[int] = set()

After Change


            param = params[self.id]
            backup = weights.copy()
            copy_array(dst=weights, src=param)
        with contextlib.ExitStack() as stack:
            for layer in self.layers:
                stack.enter_context(layer.use_params(params))
            for shim in self.shims:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: explosion/thinc
Commit Name: 20ca9d882e448df5f1a9c5c0d74772763651826a
Time: 2020-01-04
Author: honnibal+gh@gmail.com
File Name: thinc/model.py
Class Name: Model
Method Name: use_params


Project Name: matplotlib/matplotlib
Commit Name: 602be075297ae9b6b1ee172da4f52e64739cbd17
Time: 2020-06-09
Author: quantum.analyst@gmail.com
File Name: lib/matplotlib/tight_bbox.py
Class Name:
Method Name: adjust_bbox


Project Name: matplotlib/matplotlib
Commit Name: df7f0ab94f2c48739baf35684f55d6f5c5e85671
Time: 2019-12-16
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/widgets.py
Class Name: TextBox
Method Name: begin_typing