pymc.SymbolicRandomVariable.make_thunk#

SymbolicRandomVariable.make_thunk(node, storage_map, compute_map, no_recycling, impl=None)#

Create a thunk.

This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node.

Parameters:
node

Something previously returned by Op.make_node().

storage_map

A dict mapping Variables to single-element lists where a computed value for each Variable may be found.

compute_map

A dict mapping Variables to single-element lists where a boolean value can be found. The boolean indicates whether the Variable’s storage_map container contains a valid value (i.e. True) or whether it has not been computed yet (i.e. False).

no_recycling

List of Variables for which it is forbidden to reuse memory allocated by a previous call.

implstr

Description for the type of node created (e.g. "c", "py", etc.)

Notes

If the thunk consults the storage_map on every call, it is safe for it to ignore the no_recycling argument, because elements of the no_recycling list will have a value of None in the storage_map. If the thunk can potentially cache return values (like CLinker does), then it must not do so for variables in the no_recycling list.

Op.prepare_node() is always called. If it tries 'c' and it fails, then it tries 'py', and Op.prepare_node() will be called twice.