MLIR  19.0.0git
Variables
IRAttributes.cpp File Reference
#include <optional>
#include <string_view>
#include <utility>
#include "IRModule.h"
#include "PybindUtils.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/raw_ostream.h"
#include "mlir-c/BuiltinAttributes.h"
#include "mlir-c/BuiltinTypes.h"
#include "mlir/Bindings/Python/PybindAdaptors.h"

Go to the source code of this file.

Variables

static const char kDenseElementsAttrGetDocstring []
 
static const char kDenseElementsAttrGetFromListDocstring []
 
static const char kDenseResourceElementsAttrGetFromBufferDocstring []
 

Variable Documentation

◆ kDenseElementsAttrGetDocstring

const char kDenseElementsAttrGetDocstring[]
static

Definition at line 34 of file IRAttributes.cpp.

◆ kDenseElementsAttrGetFromListDocstring

const char kDenseElementsAttrGetFromListDocstring[]
static
Initial value:
=
R"(Gets a DenseElementsAttr from a Python list of attributes.
Note that it can be expensive to construct attributes individually.
For a large number of elements, consider using a Python buffer or array instead.
Args:
attrs: A list of attributes.
type: The desired shape and type of the resulting DenseElementsAttr.
If not provided, the element type is determined based on the type
of the 0th attribute and the shape is `[len(attrs)]`.
context: Explicit context, if not from context manager.
Returns:
DenseElementsAttr on success.
Raises:
ValueError: If the type of the attributes does not match the type
specified by `shaped_type`.
)"

Definition at line 76 of file IRAttributes.cpp.

◆ kDenseResourceElementsAttrGetFromBufferDocstring

const char kDenseResourceElementsAttrGetFromBufferDocstring[]
static
Initial value:
=
R"(Gets a DenseResourceElementsAttr from a Python buffer or array.
This function does minimal validation or massaging of the data, and it is
up to the caller to ensure that the buffer meets the characteristics
implied by the shape.
The backing buffer and any user objects will be retained for the lifetime
of the resource blob. This is typically bounded to the context but the
resource can have a shorter lifespan depending on how it is used in
subsequent processing.
Args:
buffer: The array or buffer to convert.
name: Name to provide to the resource (may be changed upon collision).
type: The explicit ShapedType to construct the attribute with.
context: Explicit context, if not from context manager.
Returns:
DenseResourceElementsAttr on success.
Raises:
ValueError: If the type of the buffer or array cannot be matched to an MLIR
type or if the buffer does not meet expectations.
)"

Definition at line 97 of file IRAttributes.cpp.