Created
February 10, 2023 17:49
-
-
Save ckrapu/11c414ca02100e4899b3867918a21242 to your computer and use it in GitHub Desktop.
pymc-concatenate-constant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc as pm | |
import numpy as np | |
with pm.Model() as model: | |
x = pm.Normal('x', shape=2) | |
x_2d = pm.Normal('x_2d', shape=(3,4)) | |
# Takes variable of shape (2,) and extends it to shape (3,) | |
y = pm.Deterministic('y',pm.math.concatenate([x, [0]], axis=0)) | |
# Takes variable of shape (3,4) and extends it to shape (3,5) | |
y_2d = pm.Deterministic('y_2d',pm.math.concatenate([x_2d, np.ones([3,1])], axis=1)) | |
trace = pm.sample() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment