Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

TypeError: Real.grad illegally returned an integer-valued variable - when pm.sample

Дата публикации: 12-07-2026 18:07:42

Problem solved - thanks to a related question + answer by @jessegrabowski .
The issue turned out to be the distance matrix calculation.
The function def calc_distance_to calculates the euclidean distance between a focal mic in a mic array and all other mics - leading to 0 distance for the focal mic to itself. pt.math.linalg.norm goes haywire while seeing this 0 term - and throws the error. Adding a tiny offset to the distances does not help for some reason.
Things of course worked when I replaced the focal mic indexing with a shape conform pm.Normal because the random distribution almost never produces exactly 0 values.
The solution now is somehow to add a tiny offset (e.g. 1e-9) to the distances, and using pm.math functions rather than the pt.linalg.norm. This is the version of the distance calculation that works.
def calc_distance_to(focalmic, mic_array):
'''
'''
diff = mic_array - focalmic
diff += 1e-9
norm_dist = pm.math.sqrt(pm.math.sum(diff**2, axis=1))
return norm_dist

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1🚀 Release pymc-extras v0.14.0019.6328-07-2026
2🚀 Release pymc-extras v0.13.0019.6313-07-2026
3Arviz Issues following Tutorials07.4421-07-2026
4Regarding GSOC 2027 and PyMC projects07.7328-07-2026
5🚀 Release pymc-extras v0.13.1019.6319-07-2026
6🚀 Release v6.2.0018.5223-07-2026
7New contributor looking to get started — background in ML/RAG research010.4223-07-2026
8Hidden Markov Models in PyMC: marginalize and recover a DiscreteMarkovChain04.7813-07-2026
9Pymc_forecast — a new Bayesian time-series forecasting toolkit for PyMC019.3517-07-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 9. Тональность: 0. Информативность: 7.04. Источник: discourse.pymc.io.