Error message:
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute AddV2 as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:AddV2]
In my code I create a tensorflow distribution MixtureSameFamily object and use the output of my network as parameters. However when I try to calculate the probability across a range of values in order to generate the probability density function, I receive this error.
My code:
gm = tfd.MixtureSameFamily(
mixture_distribution=tfd.Categorical(probs=alphas),
components_distribution=tfd.Normal(
loc=mus,
scale=sigmas
)
)
x = np.linspace(-2,2,int(1000), dtype=np.double)
print(x.dtype)
pyx = gm.prob(x)
The result of print(x.dtype) is "dtype: 'float'"
As far as I know tensorflow does not have support for float datatypes as per the documentation.
For this reason I am especially confused. Any help would be greatly appreciated.