alibi-detect
alibi-detect copied to clipboard
An error occurred in the _configure_kernel_centers function in the LSDDOnlineDrift class
Hi,
When I run drift detection with LSDDOnlineDrift class, the following error occurred.
[Error Message] InvalidArgumentError: cannot compute AddV2 as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:AddV2]
[Code] perturbation = tf.random.normal(self.kernel_centers.shape, mean=0, stddev=1e-6) self.kernel_centers = self.kernel_centers + perturbation
So, I tried to change the datatype of each operand and checked errors. First, I changed the type of perturbation from tf.float32 to tf.float64 with tf.cast. But I got an OOM error. And then, It was solved by changing the type of self.kernel_centers from tf.float64 to tf.float32.
I want to know this modification has no problem. What do you think about this case?
Can you show us the full code and the full stack-trace? Generally with tensorflow
and torch
frameworks, all tensors should be float32
by default, so I'm curious how the "was expected to be a double tensor" can happen.
Note that in our example notebook the data is cast to np.float32
before doing anything else (cell 4), this ensures that any further operations produce float32
tensors.
Is this something we need to document better across the library? @ojcobb @ascillitoe
Thank you very much. I got it. I will convert data type tp np.float32 for the input of the detector.
2023년 5월 26일 (금) 오후 7:33, Janis Klaise @.***>님이 작성:
Note that in our example notebook https://docs.seldon.io/projects/alibi-detect/en/stable/examples/cd_online_wine.html the data is cast to np.float32 before doing anything else (cell 4), this ensures that any further operations produce float32 tensors.
Is this something we need to document better across the library? @ojcobb https://github.com/ojcobb @ascillitoe https://github.com/ascillitoe
— Reply to this email directly, view it on GitHub https://github.com/SeldonIO/alibi-detect/issues/800#issuecomment-1564182380, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG43MBNZ5REM7JJU2Y4CF33XICBHXANCNFSM6AAAAAAYPYJTCY . You are receiving this because you authored the thread.Message ID: @.***>