Skip to content

02_tensor_basics.py #15

Open
Open
@gaushi

Description

@gaushi

Hi @python-engineer ,
on line 131, shouldn't we assign z again on CPU?
z = z.to("cpu") before then calling z.numpy()
I got following error without doing so:

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

Thanks for all the great material!
Cheers,
Gautam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions