f2754e0656d8cebe1f785f6af100e4ade241a7f8,thinc/model.py,Model,copy,#Model#,445
Before Change
for name, is_allocated in self._params.items():
if is_allocated:
copied.set_param(name, self.get_param(name))
for name, is_allocated in self._grads.items():
if is_allocated:
copied.set_grad(name, self.get_grad(name))
return copied
def to_gpu(self, gpu_id: int) -> None: // pragma: no cover
Transfer the model to a given GPU device.
After Change
shims=[shim.copy() for shim in self.shims]
)
for name in self.grad_names:
copied.set_grad(name, self .get_grad(name).copy())
return copied
def to_gpu(self, gpu_id: int) -> None: // pragma: no cover
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances Project Name: explosion/thinc
Commit Name: f2754e0656d8cebe1f785f6af100e4ade241a7f8
Time: 2020-01-14
Author: honnibal+gh@gmail.com
File Name: thinc/model.py
Class Name: Model
Method Name: copy
Project Name: explosion/thinc
Commit Name: f2754e0656d8cebe1f785f6af100e4ade241a7f8
Time: 2020-01-14
Author: honnibal+gh@gmail.com
File Name: thinc/model.py
Class Name: Model
Method Name: get_grad
Project Name: explosion/thinc
Commit Name: 019fa4d7f8216b9a906db49b64e02f9be08c3826
Time: 2019-12-25
Author: honnibal+gh@gmail.com
File Name: thinc/describe.py
Class Name: Gradient
Method Name: __get__
Project Name: explosion/thinc
Commit Name: f2754e0656d8cebe1f785f6af100e4ade241a7f8
Time: 2020-01-14
Author: honnibal+gh@gmail.com
File Name: thinc/model.py
Class Name: Model
Method Name: finish_update