Merge pull request #83 from lucasdelimanogueira/tmp

fix backward reduce distributed
This commit is contained in:
lucasdelimanogueira 2024-06-01 20:57:17 -03:00 committed by GitHub
commit 8fd0ffdd65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -7,7 +7,7 @@ Project details explanations can also be found on [medium](https://towardsdatasc
**PyNorch** is a deep learning framework constructed using C/C++, CUDA and Python. This is a personal project with educational purpose only! `Norch` means **NOT** PyTorch, and we have **NO** claims to rivaling the already established PyTorch. The main objective of **PyNorch** was to give a brief understanding of how a deep learning framework works internally. It implements the Tensor object, GPU support and an automatic differentiation system.
# 2 - Installation
Install this package from PyPi (you can test on Colab! Also tested on AWS p3 instances ami-00f1d513c2bb78c75)
Install this package from PyPi (you can test on Colab!)
```css
$ pip install norch

View file

@ -13,8 +13,11 @@ class DistributedDataParallel(Module):
def backward(self):
self.module.backward()
for module, name, parameter in self.parameters():
for module, name, _ in self.parameters():
parameter = getattr(module, name)
dist.allreduce_mean_tensor(parameter)
setattr(module, name, parameter)