You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @rachelglenn,
I strongly advise against using PythonFunction for functionality with good native support. You can get tensors filled with random values with functions from dali.fn.random. Elementwise squaring can be achieved by simply by multiplying the tensors, like:
# passing image as the argument will cause the function to return an array shaped like the imageperturbation=fn.random.uniform(image1, range=[0, 1]) # this already includes channelpert_squared=perturbation*perturbationnew_image1=image1*pert_squarednew_image2=image2*pert_squared
BTW - it seems like the code is incorrect (swapped lines?):
for i in range(c):
h, w, c = image1.shape # c defined here, but loop over range(c) above
Thank you. I really appreciate it. Another question. I have a pipeline class defined. Do I have to specify that the data loaded is to go to the gpu? Load data calls the dali numpy reader. For some reason, the output of the model (data) is on the cpu and not the gpu.
def define_graph(self):
data= self.load_data()
data= data.to('cuda')
return data
Describe the question.
How do create new torch tensors and have them go to the correct device. I would like to do things like taking the square of the tensor? I found this example:
https://docs.nvidia.com/deeplearning/dali/archives/dali_1_18_0/user-guide/docs/examples/custom_operations/python_operator.html
Check for duplicates
The text was updated successfully, but these errors were encountered: