Fix examples that uses type_as (#1129)

This commit is contained in:
Ibraheem Moosa 2020-03-14 23:02:31 +06:00 committed by GitHub
parent c0bedd2587
commit 2232eb35d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ This will make your code scale to any arbitrary number of GPUs or TPUs with Ligh
# with lightning
def forward(self, x):
z = torch.Tensor(2, 3)
z = z.type_as(x.type())
z = z.type_as(x)
Remove samplers
^^^^^^^^^^^^^^^

View File

@ -228,7 +228,7 @@ When you init a new tensor in your code, just use type_as
# put the z on the appropriate gpu or tpu core
z = sample_noise()
z = z.type_as(x.type())
z = z.type_as(x)
----------