Learn practical skills, build real-world projects, and advance your career
!pip install jovian --upgrade --quiet
import jovian
jovian.commit()
[jovian] Attempting to save notebook.. [jovian] Updating notebook "a-hash-program/fn" on https://jovian.ai [jovian] Uploading notebook.. [jovian] Uploading additional files... [jovian] Committed successfully! https://jovian.ai/a-hash-program/fn
import torch
import numpy as np
#for the documentation, I used torch.is_tensor, torch.is_complex, numel, logspace,and complex
a = torch.tensor(4., requires_grad=True)
b= torch.is_tensor(a)
c= torch.is_complex(a)
complex = torch.logspace(5,6., steps=8)
print(a,b,c,complex)
tensor(4., requires_grad=True) True False tensor([ 100000.0000, 138949.5469, 193069.7656, 268269.5938, 372759.3750, 517947.4688, 719685.6875, 1000000.0000])
realNumber = torch.tensor([33,45], dtype =torch.float32)
complexNumber = torch.tensor([999,666], dtype = torch.float32)
npy = torch.complex(realNumber,complexNumber)
print(npy)
tensor([33.+999.j, 45.+666.j])