Texte centré
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| x = torch.cat([x, x, x], dim=1) # où x est votre tenseur initial. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy.fft import fft | |
| y = fft(x) # x est un array numpy que vous avez défini au préalable. | |
| y = y[:len(y)//2] # On coupe la réponse en deux, car la seconde moitié est en miroir avec la première, donc redondante. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| total_parameters = pytorch_total_params = sum(p.numel() for p in model.parameters()) | |
| print(f"Nombre de paramètres : {total_parameters:,}") | |
| # model est un modèle que vous avez déjà défini à l'avance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nombre = 123456789 | |
| print(f"Voici mon nombre : {nombre:,}") | |
| # Ceci va afficher 123,456,789 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| parameters_list = list(model1.parameters()) + list(model2.parameters()) | |
| optimizer = torch.optim.Adam(params=parameters_list) | |
| # Il suffit donc de concaténer les listes des paramètres des différents modèles que l'on veut optimiser. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for params in model.parameters(): | |
| params.requires_grad = False | |
| # Où model est un modèle que vous avez déjà pré-défini. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conda env remove --name <NOM DE L'ENVIRONNEMENT> | |
| # Par exemple, pour supprimer un environnement qui s'appelle venvconda, on fera: | |
| # conda env remove --name venvconda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conda deactivate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conda create --name <NOM DE L'ENVIRONNEMENT> python=<VERSION DE PYTHON> | |
| # Par exemple, pour créer un environnement virutel appelé "venvconda" et avec une version 3.6.5 de Python, on utilisera: | |
| # conda create --name venvconda python=3.6.5 |