Domains

Domain

alias of builtins.type

class BintType[source]

Bases: funsor.domains.ArrayType

size
class RealsType[source]

Bases: funsor.domains.ArrayType

dtype = 'real'
class Bint[source]

Bases: object

Factory for bounded integer types:

Bint[5]           # integers ranging in {0,1,2,3,4}
Bint[2, 3, 3]     # 3x3 matrices with entries in {0,1}
dtype = None
shape = None
class Reals[source]

Bases: object

Type of a real-valued array with known shape:

Reals[()] = Real  # scalar
Reals[8]          # vector of length 8
Reals[3, 3]       # 3x3 matrix
shape = None
class Real

Bases: object

shape = ()
reals(*args)[source]
bint(size)[source]
class Dependent(fn)[source]

Bases: object

Type hint for dependently type-decorated functions.

Examples:

Dependent[Real]  # a constant known domain
Dependent[lambda x: Array[x.dtype, x.shape[1:]]  # args are Domains
Dependent[lambda x, y: Bint[x.size + y.size]]
Parameters:fn (callable) – A lambda taking named arguments (in any order) which will be filled in with the domain of the similarly named funsor argument to the decorated function. This lambda should compute a desired resulting domain given domains of arguments.
find_domain(op, *domains)[source]

Finds the Domain resulting when applying op to domains. :param callable op: An operation. :param Domain *domains: One or more input domains.