Issues with the Tutorials

Good evening,
It has been a few days now i’m trying to learn PyTorch in its C++ Frontend

Yet Not a single tutorials works as expected :

1. Installing C++ Distributions of PyTorch

After a long struggle and some help I finally managed to carry out the “Installing C++ Distributions of PyTorch”… but I had to change every single line of the building process (see this GitHub issues thread )

2. The C++ Frontend

Then I tried the “The C++ Frontend” tutorial but building it ends in 177 warnings and this error :

“D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchFrontend\build\PyTorchFrontend.vcxproj” (cible par défaut) (1) →
(ClCompile cible) →
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/serialize.h(39): error C2679: ‘<<’ b
inaire : aucun opérateur trouvé qui accepte un opérande de partie droite de type ‘const Value’ (ou il n’existe pas de c
onversion acceptable) [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchFrontend\build\PyTorchFrontend.vcxproj]

177 Avertissement(s)
1 Erreur(s)

3. Using the PyTorch C++ Frontend

Finally I tried the “Using the PyTorch C++ Frontend”. Copying and pasting the cpp code also ends in
180 warnings
24 errors

Here are the errors :

“D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj” (cible par défaut) (1) →
(ClCompile cible) →
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(99): error C2039: ‘Normalize’ : n’est pas membre
de ‘torch::data::transforms’ [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(99): error C2065: ‘Normalize’ : identificateur no
n déclaré [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(99): error C2059: erreur de syntaxe : ‘>’ [D:\Ygg
drasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(102): error C3536: ‘dataset’ : ne peut pas être u
tilisé avant d’avoir été initialisé [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(101): error C2789: ‘batches_per_epoch’ : un objet
de type qualifié const doit être initialisé [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcx
proj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(29): error C2825:
‘Dataset’ : doit être une classe ou un espace de noms lorsqu’il est suivi par ‘::’ [D:\Yggdrasil\Programmation\PyTorch
Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(29): error C2510:
‘Dataset’ : class/struct/union doit figurer à gauche de ‘::’ [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN
\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(29): error C2061:
erreur de syntaxe : identificateur ‘BatchType’ [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.v
cxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(68): error C2065:
‘Batch’ : identificateur non déclaré [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(68): error C2923:
‘torch::data::Iterator’ : ‘Batch’ n’est pas un argument de type modèle valide pour le paramètre ‘Batch’ [D:\Yggdrasil\P
rogrammation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(80): error C2065:
‘Batch’ : identificateur non déclaré [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(80): error C2923:
‘torch::data::Iterator’ : ‘Batch’ n’est pas un argument de type modèle valide pour le paramètre ‘Batch’ [D:\Yggdrasil\P
rogrammation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(182): error C2065:
‘Batch’ : identificateur non déclaré [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(182): error C2923:
‘c10::optional’ : ‘Batch’ n’est pas un argument de type modèle valide pour le paramètre ‘T’ [D:\Yggdrasil\Programmatio
n\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(144): error C2061:
erreur de syntaxe : identificateur ‘Batch’ [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxp
roj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(144): error C2535:
‘torch::data::DataLoader<int,torch::data::samplers::RandomSampler>::Result::Result(void)’ : fonction membre déjà défin
ie ou déclarée [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(147): error C2065:
‘Batch’ : identificateur non déclaré [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\libtorch\include\torch\csrc\api\include\torch/data/dataloader.h(147): error C2923:
‘c10::optional’ : ‘Batch’ n’est pas un argument de type modèle valide pour le paramètre ‘T’ [D:\Yggdrasil\Programmatio
n\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2514: ‘torch::data::Iterator’ : la c
lasse n’a aucun constructeur [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2678: ‘!=’ binaire : aucun opérateur
trouvé qui accepte un opérande de partie gauche de type ‘torch::data::Iterator’ (ou il n’existe pas de conversion acce
ptable) [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2678: ‘++’ binaire : aucun opérateur
trouvé qui accepte un opérande de partie gauche de type ‘torch::data::Iterator’ (ou il n’existe pas de conversion acce
ptable) [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2678: ‘*’ binaire : aucun opérateur
trouvé qui accepte un opérande de partie gauche de type ‘torch::data::Iterator’ (ou il n’existe pas de conversion accep
table) [D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2100: indirection non conforme [D:\Y
ggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]
D:\Yggdrasil\Programmation\PyTorch\Tutoriels\PyTorchDCGAN\dcgan.cpp(124): error C2440: ‘initialisation’ : impossible
de convertir de ‘torch::data::Iterator’ en ‘torch::data::Exampleat::Tensor,at::Tensor &’ [D:\Yggdrasil\Programmation
PyTorch\Tutoriels\PyTorchDCGAN\build\dcgan.vcxproj]

180 Avertissement(s)
24 Erreur(s)

My OS is Windows 10

I know this subject might not be for beginners in PyTorch but I don’t understand why the tutorials doesn’t work… Is anybody else experiencing the problems ?

Thanks for your interest

+1 here. The PyTorch 1.0 has released a coupon of weeks and C++ is the most import part of it according to the release note. But I don’t think C++ of PyTorch is ready for production or even development.

So the only worthy question here is : How can we help at our on level ?

Were you able to resolve the issue? The DCGAN tutorial works fine for me.

Sorry for the very late answer but no, I couldn’t. I gave it up and got back to Python… for now