Pwc

class boulderopal.graph.Pwc(operation, value_shape, durations, batch_shape)

A piecewise-constant tensor-valued function of time (or batch of such functions).

You can use the arithmetic operators +, -, *, **, /, //, and @ to perform operations between two Pwc objects or between a Pwc and a Tensor.

Variables

  • values (Tensor) – The values of the function on the piecewise-constant segments.
  • durations (np.ndarray) – The durations of the constant segments.
  • value_shape (tuple) – The shape of the function value.
  • batch_shape (tuple) – The shape of the batch in the function.
  • name (str) – The name assigned to the node.

SEE ALSO

Graph.pwc : Operation to create piecewise-constant functions.

Notes

The value of a Pwc node can be fetched in a graph calculation by adding its name in the output_node_names parameter for the function call. This will add an item to the output dictionary in the calculation result object, whose key is name. The item’s value will be a dictionary with the “durations” of the piecewise-constant segments, the “values” of the function at each segment, and its “time_dimension” (the axis of the values array that corresponds to time). Dimensions of the values trailing the time dimension represent the dimensions of the object represented by the Pwc. Dimensions preceding the time dimension represent batch dimensions.

For more information on Pwc nodes see the Working with time-dependent functions in Boulder Opal topic.

Was this useful?