INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Run performs loop iterations.
:param context: Action context. | def run(self, context: ActionContext):
"""
Run performs loop iterations.
:param context: Action context.
"""
iterator = itertools.count(start=self.start, step=self.step)
for i in iterator:
self.with_iteration(i)
if self.stop is not None and i ... |
Replace optimizer tensor.
:param model: Tensorflow tensor.
:return: Optimization instance self reference. | def with_optimizer_tensor(self, tensor: Union[tf.Tensor, tf.Operation]) -> 'Optimization':
"""
Replace optimizer tensor.
:param model: Tensorflow tensor.
:return: Optimization instance self reference.
"""
self._optimizer_tensor = tensor
return self |
Replace Tensorflow session run kwargs.
Check Tensorflow session run [documentation](https://www.tensorflow.org/api_docs/python/tf/Session).
:param kwargs: Dictionary of tensors as keys and numpy arrays or
primitive python types as values.
:return: Optimization instance s... | def with_run_kwargs(self, **kwargs: Dict[str, Any]) -> 'Optimization':
"""
Replace Tensorflow session run kwargs.
Check Tensorflow session run [documentation](https://www.tensorflow.org/api_docs/python/tf/Session).
:param kwargs: Dictionary of tensors as keys and numpy arrays or
... |
The `optimizer_tensor` is an attribute for getting optimization's
optimizer tensor. | def optimizer_tensor(self) -> Union[tf.Tensor, tf.Operation]:
"""
The `optimizer_tensor` is an attribute for getting optimization's
optimizer tensor.
"""
return _get_attr(self, _optimizer_tensor=None) |
Single-output GP conditional.
The covariance matrices used to calculate the conditional have the following shape:
- Kuu: M x M
- Kuf: M x N
- Kff: N or N x N
Further reference
-----------------
- See `gpflow.conditionals._conditional` (below) for a detailed explanation of
conditional... | def _conditional(Xnew, feat, kern, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False):
"""
Single-output GP conditional.
The covariance matrices used to calculate the conditional have the following shape:
- Kuu: M x M
- Kuf: M x N
- Kff: N or N x N
Further reference
... |
Given f, representing the GP at the points X, produce the mean and
(co-)variance of the GP at the points Xnew.
Additionally, there may be Gaussian uncertainty about f as represented by
q_sqrt. In this case `f` represents the mean of the distribution and
q_sqrt the square-root of the covariance.
Ad... | def _conditional(Xnew, X, kern, f, *, full_cov=False, q_sqrt=None, white=False, full_output_cov=None):
"""
Given f, representing the GP at the points X, produce the mean and
(co-)variance of the GP at the points Xnew.
Additionally, there may be Gaussian uncertainty about f as represented by
q_sqrt.... |
`sample_conditional` will return a sample from the conditional distribution.
In most cases this means calculating the conditional mean m and variance v and then
returning m + sqrt(v) * eps, with eps ~ N(0, 1).
However, for some combinations of Mok and Mof more efficient sampling routines exists.
The dis... | def _sample_conditional(Xnew, feat, kern, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False, num_samples=None):
"""
`sample_conditional` will return a sample from the conditional distribution.
In most cases this means calculating the conditional mean m and variance v and then
returni... |
r"""
Given a g1 and g2, and distribution p and q such that
p(g2) = N(g2;0,Kmm)
p(g1) = N(g1;0,Knn)
p(g1|g2) = N(g1;0,Knm)
And
q(g2) = N(g2;f,q_sqrt*q_sqrt^T)
This method computes the mean and (co)variance of
q(g1) = \int q(g2) p(g1|g2)
:param Kmn: M x [...] x N
:param K... | def base_conditional(Kmn, Kmm, Knn, f, *, full_cov=False, q_sqrt=None, white=False):
r"""
Given a g1 and g2, and distribution p and q such that
p(g2) = N(g2;0,Kmm)
p(g1) = N(g1;0,Knn)
p(g1|g2) = N(g1;0,Knm)
And
q(g2) = N(g2;f,q_sqrt*q_sqrt^T)
This method computes the mean and (co... |
Calculates the conditional for uncertain inputs Xnew, p(Xnew) = N(Xnew_mu, Xnew_var).
See ``conditional`` documentation for further reference.
:param Xnew_mu: mean of the inputs, size N x Din
:param Xnew_var: covariance matrix of the inputs, size N x Din x Din
:param feat: gpflow.InducingFeature object... | def uncertain_conditional(Xnew_mu, Xnew_var, feat, kern, q_mu, q_sqrt, *,
mean_function=None, full_output_cov=False, full_cov=False, white=False):
"""
Calculates the conditional for uncertain inputs Xnew, p(Xnew) = N(Xnew_mu, Xnew_var).
See ``conditional`` documentation for further... |
Returns a sample from a D-dimensional Multivariate Normal distribution
:param mean: [..., N, D]
:param cov: [..., N, D] or [..., N, D, D]
:param cov_structure: "diag" or "full"
- "diag": cov holds the diagonal elements of the covariance matrix
- "full": cov holds the full covariance matrix (without ... | def _sample_mvn(mean, cov, cov_structure=None, num_samples=None):
"""
Returns a sample from a D-dimensional Multivariate Normal distribution
:param mean: [..., N, D]
:param cov: [..., N, D] or [..., N, D, D]
:param cov_structure: "diag" or "full"
- "diag": cov holds the diagonal elements of the ... |
Reshapes fvar to the correct shape, specified by `full_cov` and `full_output_cov`.
:param fvar: has shape N x P (full_cov = False) or P x N x N (full_cov = True).
:return:
1. full_cov: True and full_output_cov: True
fvar N x P x N x P
2. full_cov: True and full_output_cov: False
fvar P x ... | def _expand_independent_outputs(fvar, full_cov, full_output_cov):
"""
Reshapes fvar to the correct shape, specified by `full_cov` and `full_output_cov`.
:param fvar: has shape N x P (full_cov = False) or P x N x N (full_cov = True).
:return:
1. full_cov: True and full_output_cov: True
fvar N... |
Roll the tensor `A` forward `num_rolls` times | def _rollaxis_right(A, num_rolls):
""" Roll the tensor `A` forward `num_rolls` times """
assert num_rolls > 0
rank = tf.rank(A)
perm = tf.concat([rank - num_rolls + tf.range(num_rolls), tf.range(rank - num_rolls)], 0)
return tf.transpose(A, perm) |
Models which used to take only Z can now pass `feat` and `Z` to this method. This method will
check for consistency and return the correct feature. This allows backwards compatibility in
for the methods. | def inducingpoint_wrapper(feat, Z):
"""
Models which used to take only Z can now pass `feat` and `Z` to this method. This method will
check for consistency and return the correct feature. This allows backwards compatibility in
for the methods.
"""
if feat is not None and Z is not None:
r... |
Custom version of _square_dist that allows sc to provide per-datapoint length
scales. sc: N x M x D. | def _cust_square_dist(A, B, sc):
"""
Custom version of _square_dist that allows sc to provide per-datapoint length
scales. sc: N x M x D.
"""
return tf.reduce_sum(tf.square((tf.expand_dims(A, 1) - tf.expand_dims(B, 0)) / sc), 2) |
Construct a tensorflow function to compute the bound on the marginal
likelihood. For a derivation of the terms in here, see the associated
SGPR notebook. | def _build_likelihood(self):
"""
Construct a tensorflow function to compute the bound on the marginal
likelihood. For a derivation of the terms in here, see the associated
SGPR notebook.
"""
num_inducing = len(self.feature)
num_data = tf.cast(tf.shape(self.Y)[0],... |
Compute the mean and variance of the latent function at some new points
Xnew. For a derivation of the terms in here, see the associated SGPR
notebook. | def _build_predict(self, Xnew, full_cov=False):
"""
Compute the mean and variance of the latent function at some new points
Xnew. For a derivation of the terms in here, see the associated SGPR
notebook.
"""
num_inducing = len(self.feature)
err = self.Y - self.mea... |
Computes the mean and variance of q(u), the variational distribution on
inducing outputs. SVGP with this q(u) should predict identically to
SGPR.
:return: mu, A | def compute_qu(self):
"""
Computes the mean and variance of q(u), the variational distribution on
inducing outputs. SVGP with this q(u) should predict identically to
SGPR.
:return: mu, A
"""
Kuf = features.Kuf(self.feature, self.kern, self.X)
Kuu = feature... |
Construct a tensorflow function to compute the bound on the marginal
likelihood. | def _build_likelihood(self):
"""
Construct a tensorflow function to compute the bound on the marginal
likelihood.
"""
# FITC approximation to the log marginal likelihood is
# log ( normal( y | mean, K_fitc ) )
# where K_fitc = Qff + diag( \nu )
# where Qf... |
Compute the mean and variance of the latent function at some new points
Xnew. | def _build_predict(self, Xnew, full_cov=False):
"""
Compute the mean and variance of the latent function at some new points
Xnew.
"""
_, _, Luu, L, _, _, gamma = self._build_common_terms()
Kus = features.Kuf(self.feature, self.kern, Xnew) # size M x Xnew
w = tf... |
Transposes tensors with leading dimensions. Leading dimensions in
permutation list represented via ellipsis `...`.
When leading dimensions are found, `transpose` method
considers them as a single grouped element indexed by 0 in `perm` list. So, passing
`perm=[-2, ..., -1]`, you assume that your input t... | def leading_transpose(tensor: tf.Tensor, perm: List[Union[int, type(...)]]) -> tf.Tensor:
"""
Transposes tensors with leading dimensions. Leading dimensions in
permutation list represented via ellipsis `...`.
When leading dimensions are found, `transpose` method
considers them as a single grouped e... |
Work out what a sensible type for the array is. if the default type
is float32, downcast 64bit float to float32. For ints, assume int32 | def normalize_num_type(num_type):
"""
Work out what a sensible type for the array is. if the default type
is float32, downcast 64bit float to float32. For ints, assume int32
"""
if isinstance(num_type, tf.DType):
num_type = num_type.as_numpy_dtype.type
if num_type in [np.float32, np.flo... |
Takes a D x M tensor `vectors' and maps it to a D x matrix_size X matrix_sizetensor
where the where the lower triangle of each matrix_size x matrix_size matrix is
constructed by unpacking each M-vector.
Native TensorFlow version of Custom Op by Mark van der Wilk.
def int_shape(x):
return list(... | def vec_to_tri(vectors, N):
"""
Takes a D x M tensor `vectors' and maps it to a D x matrix_size X matrix_sizetensor
where the where the lower triangle of each matrix_size x matrix_size matrix is
constructed by unpacking each M-vector.
Native TensorFlow version of Custom Op by Mark van der Wilk.
... |
Converts between GPflow indexing and tensorflow indexing
`method` is a function that broadcasts over the first dimension (i.e. like all tensorflow matrix ops):
`method` inputs DN1, DNN
`method` outputs DN1, DNN
:return: Function that broadcasts over the final dimension (i.e. compatible with GPfl... | def swap_dimensions(method):
"""
Converts between GPflow indexing and tensorflow indexing
`method` is a function that broadcasts over the first dimension (i.e. like all tensorflow matrix ops):
`method` inputs DN1, DNN
`method` outputs DN1, DNN
:return: Function that broadcasts over the f... |
Take inverse of lower triangular (e.g. Cholesky) matrix. This function
broadcasts over the first index.
:param M: Tensor with lower triangular structure of shape DxNxN
:return: The inverse of the Cholesky decomposition. Same shape as input. | def _inverse_lower_triangular(M):
"""
Take inverse of lower triangular (e.g. Cholesky) matrix. This function
broadcasts over the first index.
:param M: Tensor with lower triangular structure of shape DxNxN
:return: The inverse of the Cholesky decomposition. Same shape as input.
"""
if M.get... |
Make Tensorflow optimization tensor.
This method builds natural gradients optimization tensor and initializes all
necessary variables created by the optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of tuples of variatio... | def make_optimize_tensor(self, model, session=None, var_list=None):
"""
Make Tensorflow optimization tensor.
This method builds natural gradients optimization tensor and initializes all
necessary variables created by the optimizer.
:param model: GPflow model.
:pa... |
Forward-mode pushforward analogous to the pullback defined by tf.gradients.
With tf.gradients, grad_ys is the vector being pulled back, and here d_xs is
the vector being pushed forward, i.e. this computes (∂ys / ∂xs)^T ∂xs.
This is adapted from https://github.com/HIPS/autograd/pull/175#issuecom... | def _forward_gradients(ys, xs, d_xs):
"""
Forward-mode pushforward analogous to the pullback defined by tf.gradients.
With tf.gradients, grad_ys is the vector being pulled back, and here d_xs is
the vector being pushed forward, i.e. this computes (∂ys / ∂xs)^T ∂xs.
This is adapt... |
Implements equation 10 from
@inproceedings{salimbeni18,
title={Natural Gradients in Practice: Non-Conjugate Variational Inference in Gaussian Process Models},
author={Salimbeni, Hugh and Eleftheriadis, Stefanos and Hensman, James},
booktitle={AISTATS},
year={201... | def _build_natgrad_step_op(self, model, q_mu_param, q_sqrt_param, xi_transform):
"""
Implements equation 10 from
@inproceedings{salimbeni18,
title={Natural Gradients in Practice: Non-Conjugate Variational Inference in Gaussian Process Models},
author={Salimbeni, Hugh an... |
:param model: GPflow model with objective tensor.
:param session: Session where optimization will be run.
:param var_list: List of extra variables which should be trained during optimization.
:param feed_dict: Feed dictionary of tensors passed to session run method.
:param maxiter: Numbe... | def minimize(self, model, session=None, var_list=None, feed_dict=None,
maxiter=1000, initialize=True, anchor=True, step_callback=None, **kwargs):
"""
:param model: GPflow model with objective tensor.
:param session: Session where optimization will be run.
:param var_list... |
Store compilation flag at specified index in context's shared data. | def _check_index_in_compilations(context: BaseContext, index: str):
"""Store compilation flag at specified index in context's shared data."""
compilations = 'compilations'
if compilations not in context.shared_data:
return False
return index in context.shared_data[compilations] |
Build structured numpy array.
:param int type_name: StructType enum converted to integer.
:param data: encoded data as a numpy array or a structured numpy array.
:param data_dtype: numpy dtype.
:param shape: in case when a list of numpy arrays is passed the length (shape) of
... | def struct(cls, type_name: int, data: np.ndarray, data_dtype: np.dtype = None, shape: Tuple = None):
"""Build structured numpy array.
:param int type_name: StructType enum converted to integer.
:param data: encoded data as a numpy array or a structured numpy array.
:param data_dtype: nu... |
Takes snapshot of the object and replaces _parent property value on None to avoid
infitinite recursion in GPflow tree traversing.
:param item: GPflow node object.
:return: dictionary snapshot of the node object. | def _take_values(self, item: Node) -> DictBasicType:
"""Takes snapshot of the object and replaces _parent property value on None to avoid
infitinite recursion in GPflow tree traversing.
:param item: GPflow node object.
:return: dictionary snapshot of the node object."""
values ... |
Uses super()._take_values() method, but replaces content of
the cached value to the value assossiated with context's session.
:param item: GPflow parameter.
:return: dictionary snapshot of the parameter object. | def _take_values(self, item: Parameter) -> DictBasicType:
"""Uses super()._take_values() method, but replaces content of
the cached value to the value assossiated with context's session.
:param item: GPflow parameter.
:return: dictionary snapshot of the parameter object."""
ses... |
Return either this GPflow objects requires compilation at decoding time.
:param item: GPflow parameter.
:return: None or True value. | def _take_extras(self, item: Parameter) -> Optional[bool]:
"""Return either this GPflow objects requires compilation at decoding time.
:param item: GPflow parameter.
:return: None or True value.
"""
index = item.tf_compilation_index()
if index is not None:
i... |
Uses super()._take_values() method and removes autoflow cache in-place.
:param item: GPflow parameterized object.
:return: dictionary snapshot of the parameter object. | def _take_values(self, item: Parameterized) -> DictBasicType:
"""Uses super()._take_values() method and removes autoflow cache in-place.
:param item: GPflow parameterized object.
:return: dictionary snapshot of the parameter object."""
values = super()._take_values(item)
values... |
List of default supported coders. First coder in the list has higher priority. | def coders(self):
"""List of default supported coders. First coder in the list has higher priority."""
return (PrimitiveTypeCoder,
TensorFlowCoder,
FunctionCoder,
ListCoder,
DictCoder,
SliceCoder,
ParameterCo... |
Path name is a recursive representation parent path name plus the name
which was assigned to this object by its parent. In other words, it is
stack of parent name where top is always parent's original name:
`parent.pathname + parent.childname` and stop condition is root's
name.
... | def pathname(self):
"""
Path name is a recursive representation parent path name plus the name
which was assigned to this object by its parent. In other words, it is
stack of parent name where top is always parent's original name:
`parent.pathname + parent.childname` and stop con... |
Scans full list of node descendants.
:return: Generator of nodes. | def _descendants(self):
"""
Scans full list of node descendants.
:return: Generator of nodes.
"""
children = self._children
if children is not None:
for child in children.values():
yield from child._descendants
yield child |
Set child.
:param name: Child name.
:param child: Parentable object. | def _set_child(self, name, child):
"""
Set child.
:param name: Child name.
:param child: Parentable object.
"""
if not isinstance(child, Parentable):
raise ValueError('Parentable child object expected, not {child}'.format(child=child))
child._set_pare... |
Untie child from parent.
:param name: Child name.
:param child: Parentable object. | def _unset_child(self, name, child):
"""
Untie child from parent.
:param name: Child name.
:param child: Parentable object.
"""
if name not in self._children or self._children[name] is not child:
msg = 'Child {child} with name "{name}" is not found'
... |
Set parent.
:param parent: Parentable object.
:raises ValueError: Self-reference object passed.
:raises ValueError: Non-Parentable object passed. | def _set_parent(self, parent=None):
"""
Set parent.
:param parent: Parentable object.
:raises ValueError: Self-reference object passed.
:raises ValueError: Non-Parentable object passed.
"""
if parent is not None:
if not isinstance(parent, Parentable):... |
Produce samples from the posterior latent function(s) at the points
Xnew. | def predict_f_samples(self, Xnew, num_samples):
"""
Produce samples from the posterior latent function(s) at the points
Xnew.
"""
mu, var = self._build_predict(Xnew, full_cov=True) # N x P, # P x N x N
jitter = tf.eye(tf.shape(mu)[0], dtype=settings.float_type) * setting... |
Compute the mean and variance of held-out data at the points Xnew | def predict_y(self, Xnew):
"""
Compute the mean and variance of held-out data at the points Xnew
"""
pred_f_mean, pred_f_var = self._build_predict(Xnew)
return self.likelihood.predict_mean_and_var(pred_f_mean, pred_f_var) |
Compute the (log) density of the data Ynew at the points Xnew
Note that this computes the log density of the data individually,
ignoring correlations between them. The result is a matrix the same
shape as Ynew containing the log densities. | def predict_density(self, Xnew, Ynew):
"""
Compute the (log) density of the data Ynew at the points Xnew
Note that this computes the log density of the data individually,
ignoring correlations between them. The result is a matrix the same
shape as Ynew containing the log densiti... |
r"""
Construct a tensorflow function to compute the likelihood.
\log p(Y | theta). | def _build_likelihood(self):
r"""
Construct a tensorflow function to compute the likelihood.
\log p(Y | theta).
"""
K = self.kern.K(self.X) + tf.eye(tf.shape(self.X)[0], dtype=settings.float_type) * self.likelihood.variance
L = tf.cholesky(K)
m = self.mean_f... |
Xnew is a data matrix, the points at which we want to predict.
This method computes
p(F* | Y)
where F* are points on the GP at Xnew, Y are noisy observations at X. | def _build_predict(self, Xnew, full_cov=False):
"""
Xnew is a data matrix, the points at which we want to predict.
This method computes
p(F* | Y)
where F* are points on the GP at Xnew, Y are noisy observations at X.
"""
y = self.Y - self.mean_function(self... |
Compute the expectation <obj1(x) obj2(x)>_p(x)
Uses Gauss-Hermite quadrature for approximate integration.
:type p: (mu, cov) tuple or a `ProbabilityDistribution` object
:type obj1: kernel, mean function, (kernel, features), or None
:type obj2: kernel, mean function, (kernel, features), or None
:par... | def quadrature_expectation(p, obj1, obj2=None, num_gauss_hermite_points=None):
"""
Compute the expectation <obj1(x) obj2(x)>_p(x)
Uses Gauss-Hermite quadrature for approximate integration.
:type p: (mu, cov) tuple or a `ProbabilityDistribution` object
:type obj1: kernel, mean function, (kernel, fea... |
Return the function of interest (kernel or mean) for the expectation
depending on the type of :obj: and whether any features are given | def get_eval_func(obj, feature, slice=np.s_[...]):
"""
Return the function of interest (kernel or mean) for the expectation
depending on the type of :obj: and whether any features are given
"""
if feature is not None:
# kernel + feature combination
if not isinstance(feature, Inducing... |
General handling of quadrature expectations for Gaussians and DiagonalGaussians
Fallback method for missing analytic expectations | def _quadrature_expectation(p, obj1, feature1, obj2, feature2, num_gauss_hermite_points):
"""
General handling of quadrature expectations for Gaussians and DiagonalGaussians
Fallback method for missing analytic expectations
"""
num_gauss_hermite_points = 100 if num_gauss_hermite_points is None else ... |
Handling of quadrature expectations for Markov Gaussians (useful for time series)
Fallback method for missing analytic expectations wrt Markov Gaussians
Nota Bene: obj1 is always associated with x_n, whereas obj2 always with x_{n+1}
if one requires e.g. <x_{n+1} K_{x_n, Z}>_p(x_{n:n+1}), compute ... | def _quadrature_expectation(p, obj1, feature1, obj2, feature2, num_gauss_hermite_points):
"""
Handling of quadrature expectations for Markov Gaussians (useful for time series)
Fallback method for missing analytic expectations wrt Markov Gaussians
Nota Bene: obj1 is always associated with x_n, whereas ob... |
Compute the expectation <obj1(x) obj2(x)>_p(x)
Uses multiple-dispatch to select an analytical implementation,
if one is available. If not, it falls back to quadrature.
:type p: (mu, cov) tuple or a `ProbabilityDistribution` object
:type obj1: kernel, mean function, (kernel, features), or None
:type... | def expectation(p, obj1, obj2=None, nghp=None):
"""
Compute the expectation <obj1(x) obj2(x)>_p(x)
Uses multiple-dispatch to select an analytical implementation,
if one is available. If not, it falls back to quadrature.
:type p: (mu, cov) tuple or a `ProbabilityDistribution` object
:type obj1: ... |
Compute the expectation:
<diag(K_{X, X})>_p(X)
- K_{.,.} :: RBF kernel
:return: N | def _expectation(p, kern, none1, none2, none3, nghp=None):
"""
Compute the expectation:
<diag(K_{X, X})>_p(X)
- K_{.,.} :: RBF kernel
:return: N
"""
return kern.Kdiag(p.mu) |
Compute the expectation:
<K_{X, Z}>_p(X)
- K_{.,.} :: RBF kernel
:return: NxM | def _expectation(p, kern, feat, none1, none2, nghp=None):
"""
Compute the expectation:
<K_{X, Z}>_p(X)
- K_{.,.} :: RBF kernel
:return: NxM
"""
with params_as_tensors_for(kern, feat):
# use only active dimensions
Xcov = kern._slice_cov(p.cov)
Z, Xmu = kern._slice... |
Compute the expectation:
expectation[n] = <x_n K_{x_n, Z}>_p(x_n)
- K_{.,.} :: RBF kernel
:return: NxDxM | def _expectation(p, mean, none, kern, feat, nghp=None):
"""
Compute the expectation:
expectation[n] = <x_n K_{x_n, Z}>_p(x_n)
- K_{.,.} :: RBF kernel
:return: NxDxM
"""
Xmu, Xcov = p.mu, p.cov
with tf.control_dependencies([tf.assert_equal(
tf.shape(Xmu)[1], tf.constant(... |
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- Ka_{.,.}, Kb_{.,.} :: RBF kernels
Ka and Kb as well as Z1 and Z2 can differ from each other.
:return: N x dim(Z1) x dim(Z2) | def _expectation(p, kern1, feat1, kern2, feat2, nghp=None):
"""
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- Ka_{.,.}, Kb_{.,.} :: RBF kernels
Ka and Kb as well as Z1 and Z2 can differ from each other.
:return: N x dim(Z1) x dim(Z2)
"""
if kern1.on... |
Compute the expectation:
<diag(K_{X, X})>_p(X)
- K_{.,.} :: Linear kernel
:return: N | def _expectation(p, kern, none1, none2, none3, nghp=None):
"""
Compute the expectation:
<diag(K_{X, X})>_p(X)
- K_{.,.} :: Linear kernel
:return: N
"""
with params_as_tensors_for(kern):
# use only active dimensions
Xmu, _ = kern._slice(p.mu, None)
Xcov = kern._sl... |
Compute the expectation:
<K_{X, Z}>_p(X)
- K_{.,.} :: Linear kernel
:return: NxM | def _expectation(p, kern, feat, none1, none2, nghp=None):
"""
Compute the expectation:
<K_{X, Z}>_p(X)
- K_{.,.} :: Linear kernel
:return: NxM
"""
with params_as_tensors_for(kern, feat):
# use only active dimensions
Z, Xmu = kern._slice(feat.Z, p.mu)
return tf.m... |
Compute the expectation:
expectation[n] = <K_{Z, x_n} x_{n+1}^T>_p(x_{n:n+1})
- K_{.,.} :: Linear kernel
- p :: MarkovGaussian distribution (p.cov 2x(N+1)xDxD)
:return: NxMxD | def _expectation(p, kern, feat, mean, none, nghp=None):
"""
Compute the expectation:
expectation[n] = <K_{Z, x_n} x_{n+1}^T>_p(x_{n:n+1})
- K_{.,.} :: Linear kernel
- p :: MarkovGaussian distribution (p.cov 2x(N+1)xDxD)
:return: NxMxD
"""
Xmu, Xcov = p.mu, p.cov
with ... |
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- Ka_{.,.}, Kb_{.,.} :: Linear kernels
Ka and Kb as well as Z1 and Z2 can differ from each other, but this is supported
only if the Gaussian p is Diagonal (p.cov NxD) and Ka, Kb have disjoint active_dims
in which case t... | def _expectation(p, kern1, feat1, kern2, feat2, nghp=None):
"""
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- Ka_{.,.}, Kb_{.,.} :: Linear kernels
Ka and Kb as well as Z1 and Z2 can differ from each other, but this is supported
only if the Gaussian p is Diago... |
Compute the expectation:
expectation[n] = <x_n K_{x_n, Z}>_p(x_n)
- K_{.,} :: Linear kernel
or the equivalent for MarkovGaussian
:return: NxDxM | def _expectation(p, mean, none, kern, feat, nghp=None):
"""
Compute the expectation:
expectation[n] = <x_n K_{x_n, Z}>_p(x_n)
- K_{.,} :: Linear kernel
or the equivalent for MarkovGaussian
:return: NxDxM
"""
return tf.matrix_transpose(expectation(p, (kern, feat), mean)) |
Compute the expectation:
expectation[n] = <m(x_n)^T K_{x_n, Z}>_p(x_n)
- m(x_i) = c :: Constant function
- K_{.,.} :: Kernel function
:return: NxQxM | def _expectation(p, constant_mean, none, kern, feat, nghp=None):
"""
Compute the expectation:
expectation[n] = <m(x_n)^T K_{x_n, Z}>_p(x_n)
- m(x_i) = c :: Constant function
- K_{.,.} :: Kernel function
:return: NxQxM
"""
with params_as_tensors_for(constant_mean):
c =... |
Compute the expectation:
expectation[n] = <m(x_n)^T K_{x_n, Z}>_p(x_n)
- m(x_i) = A x_i + b :: Linear mean function
- K_{.,.} :: Kernel function
:return: NxQxM | def _expectation(p, linear_mean, none, kern, feat, nghp=None):
"""
Compute the expectation:
expectation[n] = <m(x_n)^T K_{x_n, Z}>_p(x_n)
- m(x_i) = A x_i + b :: Linear mean function
- K_{.,.} :: Kernel function
:return: NxQxM
"""
with params_as_tensors_for(linear_mea... |
Compute the expectation:
<m(X)>_p(X)
- m(x) :: Linear, Identity or Constant mean function
:return: NxQ | def _expectation(p, mean, none1, none2, none3, nghp=None):
"""
Compute the expectation:
<m(X)>_p(X)
- m(x) :: Linear, Identity or Constant mean function
:return: NxQ
"""
return mean(p.mu) |
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.), m2(.) :: Constant mean functions
:return: NxQ1xQ2 | def _expectation(p, mean1, none1, mean2, none2, nghp=None):
"""
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.), m2(.) :: Constant mean functions
:return: NxQ1xQ2
"""
return mean1(p.mu)[:, :, None] * mean2(p.mu)[:, None, :] |
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.) :: Identity mean function
- m2(.) :: Linear mean function
:return: NxDxQ | def _expectation(p, mean1, none1, mean2, none2, nghp=None):
"""
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.) :: Identity mean function
- m2(.) :: Linear mean function
:return: NxDxQ
"""
with params_as_tensors_for(mean2):
N = tf.shape(p.mu)... |
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.) :: Linear mean function
- m2(.) :: Identity mean function
:return: NxQxD | def _expectation(p, mean1, none1, mean2, none2, nghp=None):
"""
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.) :: Linear mean function
- m2(.) :: Identity mean function
:return: NxQxD
"""
with params_as_tensors_for(mean1):
N = tf.shape(p.mu)... |
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.), m2(.) :: Linear mean functions
:return: NxQ1xQ2 | def _expectation(p, mean1, none1, mean2, none2, nghp=None):
"""
Compute the expectation:
expectation[n] = <m1(x_n)^T m2(x_n)>_p(x_n)
- m1(.), m2(.) :: Linear mean functions
:return: NxQ1xQ2
"""
with params_as_tensors_for(mean1, mean2):
e_xxt = p.cov + (p.mu[:, :, None] * p.mu[:,... |
r"""
Compute the expectation:
<\Sum_i Ki_{X, Z}>_p(X)
- \Sum_i Ki_{.,.} :: Sum kernel
:return: NxM | def _expectation(p, kern, feat, none2, none3, nghp=None):
r"""
Compute the expectation:
<\Sum_i Ki_{X, Z}>_p(X)
- \Sum_i Ki_{.,.} :: Sum kernel
:return: NxM
"""
return functools.reduce(tf.add, [
expectation(p, (k, feat), nghp=nghp) for k in kern.kernels]) |
r"""
Compute the expectation:
expectation[n] = <m(x_n)^T (\Sum_i Ki_{x_n, Z})>_p(x_n)
- \Sum_i Ki_{.,.} :: Sum kernel
:return: NxQxM | def _expectation(p, mean, none, kern, feat, nghp=None):
r"""
Compute the expectation:
expectation[n] = <m(x_n)^T (\Sum_i Ki_{x_n, Z})>_p(x_n)
- \Sum_i Ki_{.,.} :: Sum kernel
:return: NxQxM
"""
return functools.reduce(tf.add, [
expectation(p, mean, (k, feat), nghp=nghp) for k in ... |
r"""
Compute the expectation:
expectation[n] = <(\Sum_i K1_i_{Z1, x_n}) (\Sum_j K2_j_{x_n, Z2})>_p(x_n)
- \Sum_i K1_i_{.,.}, \Sum_j K2_j_{.,.} :: Sum kernels
:return: NxM1xM2 | def _expectation(p, kern1, feat1, kern2, feat2, nghp=None):
r"""
Compute the expectation:
expectation[n] = <(\Sum_i K1_i_{Z1, x_n}) (\Sum_j K2_j_{x_n, Z2})>_p(x_n)
- \Sum_i K1_i_{.,.}, \Sum_j K2_j_{.,.} :: Sum kernels
:return: NxM1xM2
"""
crossexps = []
if kern1 == kern2 and feat1 ... |
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- K_lin_{.,.} :: RBF kernel
- K_rbf_{.,.} :: Linear kernel
Different Z1 and Z2 are handled if p is diagonal and K_lin and K_rbf have disjoint
active_dims, in which case the joint expectations simplify into a product... | def _expectation(p, rbf_kern, feat1, lin_kern, feat2, nghp=None):
"""
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- K_lin_{.,.} :: RBF kernel
- K_rbf_{.,.} :: Linear kernel
Different Z1 and Z2 are handled if p is diagonal and K_lin and K_rbf have disjoint... |
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- K_lin_{.,.} :: Linear kernel
- K_rbf_{.,.} :: RBF kernel
Different Z1 and Z2 are handled if p is diagonal and K_lin and K_rbf have disjoint
active_dims, in which case the joint expectations simplify into a product... | def _expectation(p, lin_kern, feat1, rbf_kern, feat2, nghp=None):
"""
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- K_lin_{.,.} :: Linear kernel
- K_rbf_{.,.} :: RBF kernel
Different Z1 and Z2 are handled if p is diagonal and K_lin and K_rbf have disjoint... |
r"""
Compute the expectation:
<\HadamardProd_i diag(Ki_{X[:, active_dims_i], X[:, active_dims_i]})>_p(X)
- \HadamardProd_i Ki_{.,.} :: Product kernel
- p :: DiagonalGaussian distribution (p.cov NxD)
:return: N | def _expectation(p, kern, none1, none2, none3, nghp=None):
r"""
Compute the expectation:
<\HadamardProd_i diag(Ki_{X[:, active_dims_i], X[:, active_dims_i]})>_p(X)
- \HadamardProd_i Ki_{.,.} :: Product kernel
- p :: DiagonalGaussian distribution (p.cov NxD)
:retur... |
r"""
Compute the expectation:
expectation[n] = < prodK_{Z, x_n} prodK_{x_n, Z} >_p(x_n)
= < (\HadamardProd_i Ki_{Z[:, active_dims_i], x[n, active_dims_i]}) <-- Mx1
1xM --> (\HadamardProd_j Kj_{x[n, active_dims_j], Z[:, active_dims_j]}) >_p(x_n) (MxM)
- \HadamardProd... | def _expectation(p, kern1, feat1, kern2, feat2, nghp=None):
r"""
Compute the expectation:
expectation[n] = < prodK_{Z, x_n} prodK_{x_n, Z} >_p(x_n)
= < (\HadamardProd_i Ki_{Z[:, active_dims_i], x[n, active_dims_i]}) <-- Mx1
1xM --> (\HadamardProd_j Kj_{x[n, active_dims_j]... |
Nota Bene: if only one object is passed, obj1 is
associated with x_n, whereas obj2 with x_{n+1} | def _expectation(p, obj1, feat1, obj2, feat2, nghp=None):
"""
Nota Bene: if only one object is passed, obj1 is
associated with x_n, whereas obj2 with x_{n+1}
"""
if obj2 is None:
gaussian = Gaussian(p.mu[:-1], p.cov[0, :-1])
return expectation(gaussian, (obj1, feat1), nghp=nghp)
... |
A straight-forward HMC implementation. The mass matrix is assumed to be the
identity.
The gpflow model must implement `build_objective` method to build `f` function
(tensor) which in turn based on model's internal trainable parameters `x`.
f(x) = E(x)
we then generate samp... | def sample(self, model, num_samples, epsilon,
lmin=1, lmax=1, thin=1, burn=0,
session=None, initialize=True, anchor=True,
logprobs=True):
"""
A straight-forward HMC implementation. The mass matrix is assumed to be the
identity.
The gpflow mod... |
r"""
Given a Normal distribution for the latent function,
return the mean of Y
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive mean
\int\int y p(y|f)q(f) df dy
and the predictive va... | def predict_mean_and_var(self, Fmu, Fvar):
r"""
Given a Normal distribution for the latent function,
return the mean of Y
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive mean
\int\in... |
r"""
Given a Normal distribution for the latent function, and a datum Y,
compute the log predictive density of Y.
i.e. if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive density
\log \int p(y=... | def predict_density(self, Fmu, Fvar, Y):
r"""
Given a Normal distribution for the latent function, and a datum Y,
compute the log predictive density of Y.
i.e. if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes t... |
r"""
Compute the expected log density of the data, given a Gaussian
distribution for the function values.
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes
\int (\log p(y|f)) q(f) df.
Here, we impl... | def variational_expectations(self, Fmu, Fvar, Y):
r"""
Compute the expected log density of the data, given a Gaussian
distribution for the function values.
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes
... |
args is a list of tensors, to be passed to self.likelihoods.<func_name>
args[-1] is the 'Y' argument, which contains the indexes to self.likelihoods.
This function splits up the args using dynamic_partition, calls the
relevant function on the likelihoods, and re-combines the result. | def _partition_and_stitch(self, args, func_name):
"""
args is a list of tensors, to be passed to self.likelihoods.<func_name>
args[-1] is the 'Y' argument, which contains the indexes to self.likelihoods.
This function splits up the args using dynamic_partition, calls the
releva... |
A helper function for making predictions. Constructs a probability
matrix where each row output the probability of the corresponding
label, and the rows match the entries of F.
Note that a matrix of F values is flattened. | def _make_phi(self, F):
"""
A helper function for making predictions. Constructs a probability
matrix where each row output the probability of the corresponding
label, and the rows match the entries of F.
Note that a matrix of F values is flattened.
"""
scaled_bi... |
r"""
Given a Normal distribution for the latent function,
return the mean of Y
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive mean
\int\int y p(y|f)q(f) df dy
and the predictive va... | def predict_mean_and_var(self, Fmu, Fvar, epsilon=None):
r"""
Given a Normal distribution for the latent function,
return the mean of Y
if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive mean
... |
r"""
Given a Normal distribution for the latent function, and a datum Y,
compute the log predictive density of Y.
i.e. if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this method computes the predictive density
\log \int p(y=... | def predict_density(self, Fmu, Fvar, Y, epsilon=None):
r"""
Given a Normal distribution for the latent function, and a datum Y,
compute the log predictive density of Y.
i.e. if
q(f) = N(Fmu, Fvar)
and this object represents
p(y|f)
then this met... |
r"""
Compute the expected log density of the data, given a Gaussian
distribution for the function values.
if
q(f) = N(Fmu, Fvar) - Fmu: N x D Fvar: N x D
and this object represents
p(y|f) - Y: N x 1
then this method computes
\int (\log p... | def variational_expectations(self, Fmu, Fvar, Y, epsilon=None):
r"""
Compute the expected log density of the data, given a Gaussian
distribution for the function values.
if
q(f) = N(Fmu, Fvar) - Fmu: N x D Fvar: N x D
and this object represents
p(y|f)... |
Absorbs a Z^t gate into a W(a) flip.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───Z^t───
≡ ───W(a)───────────Z^t/2──────────Z^t/2─── (split Z)
≡ ───W(a)───W(a)───Z^-t/2───W(a)───Z^t/2─── (flip Z)
≡ ───W(a)───W(a)──────────W(a+t... | def _absorb_z_into_w(moment_index: int,
op: ops.Operation,
state: _OptimizerState) -> None:
"""Absorbs a Z^t gate into a W(a) flip.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───Z^t───
≡ ───W(a)────... |
Grabs or cancels a held W gate against an existing W gate.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───W(b)───
≡ ───Z^-a───X───Z^a───Z^-b───X───Z^b───
≡ ───Z^-a───Z^-a───Z^b───X───X───Z^b───
≡ ───Z^-a───Z^-a───Z^b───Z^b───
... | def _potential_cross_whole_w(moment_index: int,
op: ops.Operation,
tolerance: float,
state: _OptimizerState) -> None:
"""Grabs or cancels a held W gate against an existing W gate.
[Where W(a) is shorthand for PhasedX(phase_e... |
Cross the held W over a partial W gate.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───W(b)^t───
≡ ───Z^-a───X───Z^a───W(b)^t────── (expand W(a))
≡ ───Z^-a───X───W(b-a)^t───Z^a──── (move Z^a across, phasing axis)
≡ ───Z^-a───W(a-... | def _potential_cross_partial_w(moment_index: int,
op: ops.Operation,
state: _OptimizerState) -> None:
"""Cross the held W over a partial W gate.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(... |
Crosses exactly one W flip over a partial CZ.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
──────────@─────
│
───W(a)───@^t───
≡ ───@──────O──────@────────────────────
| | │ (split... | def _single_cross_over_cz(moment_index: int,
op: ops.Operation,
qubit_with_w: ops.Qid,
state: _OptimizerState) -> None:
"""Crosses exactly one W flip over a partial CZ.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Us... |
Crosses two W flips over a partial CZ.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───@─────
│
───W(b)───@^t───
≡ ──────────@────────────W(a)───
│ (single-cross top W over CZ)
... | def _double_cross_over_cz(op: ops.Operation,
state: _OptimizerState) -> None:
"""Crosses two W flips over a partial CZ.
[Where W(a) is shorthand for PhasedX(phase_exponent=a).]
Uses the following identity:
───W(a)───@─────
│
───W(b)───@^t───
... |
Validates that a probability is between 0 and 1 inclusively.
Args:
p: The value to validate.
p_str: What to call the probability in error messages.
Returns:
The probability p if the probability if valid.
Raises:
ValueError if the probability is invalid. | def validate_probability(p: float, p_str: str) -> float:
"""Validates that a probability is between 0 and 1 inclusively.
Args:
p: The value to validate.
p_str: What to call the probability in error messages.
Returns:
The probability p if the probability if valid.
Raises:
... |
Returns a list of operations apply this gate to each of the targets.
Args:
*targets: The qubits to apply this gate to.
Returns:
Operations applying this gate to the target qubits.
Raises:
ValueError if targets are not instances of Qid. | def on_each(self, *targets: raw_types.Qid) -> op_tree.OP_TREE:
"""Returns a list of operations apply this gate to each of the targets.
Args:
*targets: The qubits to apply this gate to.
Returns:
Operations applying this gate to the target qubits.
Raises:
... |
Returns a phased version of the effect.
For example, an X gate phased by 90 degrees would be a Y gate.
This works by calling `val`'s _phase_by_ method and returning
the result.
Args:
val: The value to describe with a unitary matrix.
phase_turns: The amount to phase the gate, in fractio... | def phase_by(val: Any, phase_turns: float, qubit_index: int,
default: TDefault = RaiseTypeErrorIfNotProvided):
"""Returns a phased version of the effect.
For example, an X gate phased by 90 degrees would be a Y gate.
This works by calling `val`'s _phase_by_ method and returning
the result.... |
Returns an Engine instance configured using environment variables.
If the environment variables are set, but incorrect, an authentication
failure will occur when attempting to run jobs on the engine.
Required Environment Variables:
QUANTUM_ENGINE_PROJECT: The name of a google cloud project, with t... | def engine_from_environment() -> Engine:
"""Returns an Engine instance configured using environment variables.
If the environment variables are set, but incorrect, an authentication
failure will occur when attempting to run jobs on the engine.
Required Environment Variables:
QUANTUM_ENGINE_PRO... |
Plot the state histogram from a single result with repetitions.
States is a bitstring representation of all the qubit states in a single
result.
Currently this function assumes each measurement gate applies to only
a single qubit.
Args:
result: The trial results to plot.
Returns:
... | def plot_state_histogram(result: trial_result.TrialResult) -> np.ndarray:
"""Plot the state histogram from a single result with repetitions.
States is a bitstring representation of all the qubit states in a single
result.
Currently this function assumes each measurement gate applies to only
a singl... |
Converts sweep into an equivalent protobuf representation. | def sweep_to_proto_dict(sweep: Sweep, repetitions: int=1) -> Dict:
"""Converts sweep into an equivalent protobuf representation."""
msg = {} # type: Dict
if not sweep == UnitSweep:
sweep = _to_zip_product(sweep)
msg['sweep'] = {
'factors': [_sweep_zip_to_proto_dict(cast(Zip, fac... |
Converts sweep to a product of zips of single sweeps, if possible. | def _to_zip_product(sweep: Sweep) -> Product:
"""Converts sweep to a product of zips of single sweeps, if possible."""
if not isinstance(sweep, Product):
sweep = Product(sweep)
if not all(isinstance(f, Zip) for f in sweep.factors):
factors = [f if isinstance(f, Zip) else Zip(f) for f in swee... |
Implementation of `SupportsApproximateEquality` protocol. | def _approx_eq_(self, other: Any, atol: float) -> bool:
"""Implementation of `SupportsApproximateEquality` protocol."""
if not isinstance(other, type(self)):
return NotImplemented
#self.value = value % period in __init__() creates a Mod
if isinstance(other.value, sympy.Mod):... |
Removes redundant acquaintance opportunities. | def remove_redundant_acquaintance_opportunities(
strategy: circuits.Circuit) -> int:
"""Removes redundant acquaintance opportunities."""
if not is_acquaintance_strategy(strategy):
raise TypeError('not is_acquaintance_strategy(circuit)')
qubits = sorted(strategy.all_qubits())
mapping = {... |
Runs the supplied Circuit or Schedule, mimicking quantum hardware.
In contrast to run, this allows for sweeping over different parameter
values.
Args:
program: The circuit or schedule to simulate.
params: Parameters to run with the program.
repetitions: The ... | def run_sweep(
self,
program: Union[circuits.Circuit, schedules.Schedule],
params: study.Sweepable,
repetitions: int = 1,
) -> List[study.TrialResult]:
"""Runs the supplied Circuit or Schedule, mimicking quantum hardware.
In contrast to run, this allows for sweeping ... |
Run a simulation, mimicking quantum hardware.
Args:
circuit: The circuit to simulate.
param_resolver: Parameters to run with the program.
repetitions: Number of times to repeat the run.
Returns:
A dictionary from measurement gate key to measurement
... | def _run(
self,
circuit: circuits.Circuit,
param_resolver: study.ParamResolver,
repetitions: int
) -> Dict[str, np.ndarray]:
"""Run a simulation, mimicking quantum hardware.
Args:
circuit: The circuit to simulate.
param_resolver: Parameters to... |
Computes SamplesDisplays in the supplied Circuit or Schedule.
Args:
program: The circuit or schedule to simulate.
param_resolver: Parameters to run with the program.
Returns:
ComputeDisplaysResult for the simulation. | def compute_samples_displays(
self,
program: Union[circuits.Circuit, schedules.Schedule],
param_resolver: 'study.ParamResolverOrSimilarType' = None,
) -> study.ComputeDisplaysResult:
"""Computes SamplesDisplays in the supplied Circuit or Schedule.
Args:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.