aesara.tensor.TensorType#
- class aesara.tensor.TensorType(dtype: str | dtype, shape: Iterable[bool | int | None] | None = None, name: str | None = None, broadcastable: Iterable[bool] | None = None)[source]#
Symbolic
Type
representingnumpy.ndarray
s.- __init__(dtype: str | dtype, shape: Iterable[bool | int | None] | None = None, name: str | None = None, broadcastable: Iterable[bool] | None = None)[source]#
- Parameters:
dtype – A NumPy dtype (e.g.
"int64"
).shape – The static shape information.
None
s are used to indicate unknown shape values for their respective dimensions. Ifshape
is a list ofbool
s, theTrue
elements of are converted to1
s and theFalse
values are converted toNone
s.name – Optional name for this type.
Methods
__init__
(dtype[, shape, name, broadcastable])- param dtype:
A NumPy dtype (e.g.
"int64"
).
c_cleanup
(name, sub)Return C code to clean up after
CLinkerType.c_extract()
.c_code_cache_version
()Return a tuple of integers indicating the version of this type.
c_compile_args
(**kwargs)Return a list of recommended compile arguments for code returned by other methods in this class.
c_declare
(name, sub[, check_input])Return C code to declare variables that will be instantiated by
CLinkerType.c_extract()
.c_element_type
()Return the name of the primitive C type of items into variables handled by this type.
c_extract
(name, sub[, check_input])Return C code to extract a
PyObject *
instance.c_extract_out
(name, sub[, check_input])Return C code to extract a
PyObject *
instance.c_header_dirs
(**kwargs)Return a list of header search paths required by code returned by this class.
c_headers
(**kwargs)Return a list of header files required by code returned by this class.
c_init
(name, sub)Return C code to initialize the variables that were declared by
CLinkerType.c_declare()
.c_init_code
(**kwargs)Return a list of code snippets to be inserted in module initialization.
c_is_simple
()Return
True
for small or builtin C types.c_lib_dirs
(**kwargs)Return a list of library search paths required by code returned by this class.
c_libraries
(**kwargs)Return a list of libraries required by code returned by this class.
c_literal
(data)Provide a C literal string value for the specified
data
.c_no_compile_args
(**kwargs)Return a list of incompatible
gcc
compiler arguments.c_support_code
(**kwargs)Return utility code for use by a
Variable
orOp
.c_sync
(name, sub)Return C code to pack C types back into a
PyObject
.clone
([dtype, shape, broadcastable])Clone a copy of this type with the given arguments/keyword values, if any.
convert_variable
(var)Produce a
Variable
that's compatible with bothself
andvar.type
, if possible.dtype_specs
()Return a tuple (python type, c type, numpy typenum) that corresponds to self.dtype.
filter
(data[, strict, allow_downcast])Convert
data
to something which can be associated to aTensorVariable
.filter_inplace
(value, storage[, strict, ...])Return data or an appropriately wrapped/converted data by converting it in-place.
filter_variable
(other[, allow_convert])Convert a
other
into aVariable
with aType
that's compatible withself
.get_shape_info
(obj)Return the information needed to compute the memory size of
obj
.get_size
(shape_info)Number of bytes taken by the object represented by
shape_info
.in_same_class
(otype)Determine if
otype
is in the same class of fixed broadcastable types asself
.is_super
(otype)Determine if
self
is a supertype ofotype
.is_valid_value
(data[, strict])Return
True
for any python object that would be a legal value for aVariable
of thisType
.make_constant
(value[, name])Return a new
Constant
instance of thisType
.make_variable
([name])Return a new
Variable
instance of thisType
.may_share_memory
(a, b)to_scalar_type
()values_eq
(a, b[, force_same_dtype])Return
True
ifa
andb
can be considered exactly equal.values_eq_approx
(a, b[, allow_remove_inf, ...])Return
True
ifa
andb
can be considered approximately equal.Attributes
broadcastable
A boolean tuple indicating which dimensions have a shape equal to one.
context_name
dtype_specs_map
filter_checks_isfinite
When this is
True
, strict filtering rejects data containingnumpy.nan
ornumpy.inf
entries.ndim
The number of dimensions that a
Variable`
's values will have at evaluation time.dtype
shape