MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::python::PyAttribute Class Reference

Wrapper around the generic MlirAttribute. More...

#include "Bindings/Python/IRModule.h"

+ Inheritance diagram for mlir::python::PyAttribute:

Public Member Functions

 PyAttribute (PyMlirContextRef contextRef, MlirAttribute attr)
 
bool operator== (const PyAttribute &other) const
 
 operator MlirAttribute () const
 
MlirAttribute get () const
 
pybind11::object getCapsule ()
 Gets a capsule wrapping the void* within the MlirAttribute. More...
 
- Public Member Functions inherited from mlir::python::BaseContextObject
 BaseContextObject (PyMlirContextRef ref)
 
PyMlirContextRefgetContext ()
 Accesses the context reference. More...
 

Static Public Member Functions

static PyAttribute createFromCapsule (pybind11::object capsule)
 Creates a PyAttribute from the MlirAttribute wrapped by a capsule. More...
 

Detailed Description

Wrapper around the generic MlirAttribute.

The lifetime of a type is bound by the PyContext that created it.

Definition at line 993 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyAttribute()

mlir::python::PyAttribute::PyAttribute ( PyMlirContextRef  contextRef,
MlirAttribute  attr 
)
inline

Definition at line 995 of file IRModule.h.

Referenced by createFromCapsule().

Member Function Documentation

◆ createFromCapsule()

PyAttribute PyAttribute::createFromCapsule ( pybind11::object  capsule)
static

Creates a PyAttribute from the MlirAttribute wrapped by a capsule.

Note that PyAttribute instances are uniqued, so the returned object may be a pre-existing object. Ownership of the underlying MlirAttribute is taken by calling this function.

Definition at line 1907 of file IRCore.cpp.

References mlir::python::PyMlirContext::forContext(), mlirAttributeGetContext(), mlirAttributeIsNull(), mlirPythonCapsuleToAttribute(), and PyAttribute().

◆ get()

MlirAttribute mlir::python::PyAttribute::get ( ) const
inline

Definition at line 999 of file IRModule.h.

◆ getCapsule()

py::object PyAttribute::getCapsule ( )

Gets a capsule wrapping the void* within the MlirAttribute.

Definition at line 1903 of file IRCore.cpp.

References mlirPythonAttributeToCapsule().

◆ operator MlirAttribute()

mlir::python::PyAttribute::operator MlirAttribute ( ) const
inline

Definition at line 998 of file IRModule.h.

◆ operator==()

bool PyAttribute::operator== ( const PyAttribute other) const

Definition at line 1899 of file IRCore.cpp.

References mlirAttributeEqual().


The documentation for this class was generated from the following files: