MultiTaskGaussianProcessRegressionModel issue with tf.function
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python, tensorflow
- Bereich
- machine-learning
Rechercherichtung
Beginnen Sie damit, das Beispiel mit tf.function und der input_signature-Form [None, 1] zu reproduzieren. Untersuchen Sie tensorflow_probability/python/experimental/distributions/multitask_gaussian_process_regression_model.py, insbesondere _compute_flattened_covariance und die Behandlung der gemeldeten Dimensionen, und überprüfen Sie anschließend, dass das Beispiel bei unbekannten Dimensionen keinen UnboundLocalError mehr auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hi, I have encountered an error when using tf.function decorator on a function calling MultiTaskGaussianProcessRegressionModel from the experimental package. The error occurs specifically when passing input_signature of unknown dimension to tf.function. Below are the details. Thanks!
Code
import tensorflow as tf
import tensorflow_probability as tfp
tfde = tfp.experimental.distributions
tfk = tfp.math.psd_kernels
tfke = tfp.experimental.psd_kernels
base_kernel = tfk.ExponentiatedQuadratic(
amplitude=tf.convert_to_tensor(0.6, tf.float64),
length_scale=tf.convert_to_tensor(0.5, tf.float64),
)
kernel = tfke.Independent(num_tasks=2, base_kernel=base_kernel)
observations = tf.constant([[0., 1.],[-0.5, -1.0]], tf.float64)
observation_index_points = tf.constant([[0],[1.0]], tf.float64)
@tf.function(input_signature=[tf.TensorSpec(shape=[None, 1], dtype=tf.float64)])
def predict(index_points):
gp = tfde.MultiTaskGaussianProcessRegressionModel(
kernel=kernel,
observations=observations,
observation_index_points=observation_index_points,
index_points=index_points,
)
return gp.mean()
predict(tf.constant([[0.2],[0.4],[0.6]], tf.float64))
The code above works:
- if we remove
tf.function, or - if we remove
input_signatureinside withtf.function
We get the following error if we set shape=[None, 1] inside tf.TensorSpec:
UnboundLocalError: in user code:
File "/tmp/ipykernel_299029/1064227357.py", line 24, in predict *
return gp.mean()
File "/usr/.local/lib/python3.12/site-packages/tensorflow_probability/python/distributions/distribution.py", line 1536, in mean **
return self._mean(**kwargs)
File "/usr/.local/lib/python3.12/site-packages/tensorflow_probability/python/experimental/distributions/multitask_gaussian_process_regression_model.py", line 852, in _mean
self._get_flattened_marginal_distribution(
File "/usr/.local/lib/python3.12/site-packages/tensorflow_probability/python/experimental/distributions/multitask_gaussian_process_regression_model.py", line 831, in _get_flattened_marginal_distribution
covariance = self._compute_flattened_covariance(index_points)
File "/usr/.local/lib/python3.12/site-packages/tensorflow_probability/python/experimental/distributions/multitask_gaussian_process_regression_model.py", line 811, in _compute_flattened_covariance
cholinv_kzx = observation_scale.solve(kxz, adjoint_arg=True)
UnboundLocalError: cannot access local variable 'dim' where it is not associated with a value
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 4.4k
- Forks
- 1.1k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus tensorflow/probability
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KLEvtl. vergeben @Andreas-Hum hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
tensorflow/probability#2036 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 54/100
tensorflow/probability#2040 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
tensorflow/probability#2034 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
tensorflow/probability#2021 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
tensorflow/probability#2015 ·
Alle Issues in tensorflow/probability
Ähnliche Issues
-
training
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
tinaudio/synth-setter#3758 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bot-triaged module: correctness (silent) module: data module: error checking triage review
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 71/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
vllm-project/vllm-ascend#21392 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag