Lines Matching refs:py

19 namespace py = pybind11;
35 static void pyListToVector(const py::list &list, in pyListToVector()
38 result.reserve(py::len(list)); in pyListToVector()
39 for (py::handle item : list) { in pyListToVector()
42 } catch (py::cast_error &err) { in pyListToVector()
46 throw py::cast_error(msg); in pyListToVector()
47 } catch (py::reference_cast_error &err) { in pyListToVector()
51 throw py::cast_error(msg); in pyListToVector()
83 using ClassTy = py::class_<DerivedTy, BaseTy>;
94 auto origRepr = py::repr(py::cast(orig)).cast<std::string>(); in castFrom()
102 static void bind(py::module &m) { in bind()
103 auto cls = ClassTy(m, DerivedTy::pyClassName, py::module_local()); in bind()
104 cls.def(py::init<PyAffineExpr &>(), py::arg("expr")); in bind()
110 py::arg("other")); in bind()
132 c.def_static("get", &PyAffineConstantExpr::get, py::arg("value"), in bindDerived()
133 py::arg("context") = py::none()); in bindDerived()
152 c.def_static("get", &PyAffineDimExpr::get, py::arg("position"), in bindDerived()
153 py::arg("context") = py::none()); in bindDerived()
172 c.def_static("get", &PyAffineSymbolExpr::get, py::arg("position"), in bindDerived()
173 py::arg("context") = py::none()); in bindDerived()
353 py::object PyAffineExpr::getCapsule() { in getCapsule()
354 return py::reinterpret_steal<py::object>( in getCapsule()
358 PyAffineExpr PyAffineExpr::createFromCapsule(py::object capsule) { in createFromCapsule()
361 throw py::error_already_set(); in createFromCapsule()
412 py::object PyAffineMap::getCapsule() { in getCapsule()
413 return py::reinterpret_steal<py::object>(mlirPythonAffineMapToCapsule(*this)); in getCapsule()
416 PyAffineMap PyAffineMap::createFromCapsule(py::object capsule) { in createFromCapsule()
419 throw py::error_already_set(); in createFromCapsule()
442 static void bind(py::module &m) { in bind()
443 py::class_<PyIntegerSetConstraint>(m, "IntegerSetConstraint", in bind()
444 py::module_local()) in bind()
489 py::object PyIntegerSet::getCapsule() { in getCapsule()
490 return py::reinterpret_steal<py::object>( in getCapsule()
494 PyIntegerSet PyIntegerSet::createFromCapsule(py::object capsule) { in createFromCapsule()
497 throw py::error_already_set(); in createFromCapsule()
503 void mlir::python::populateIRAffine(py::module &m) { in populateIRAffine()
507 py::class_<PyAffineExpr>(m, "AffineExpr", py::module_local()) in populateIRAffine()
546 [](PyAffineExpr &self, py::object &other) { return false; }) in populateIRAffine()
620 .def_static("get_constant", &PyAffineConstantExpr::get, py::arg("value"), in populateIRAffine()
621 py::arg("context") = py::none(), in populateIRAffine()
624 "get_dim", &PyAffineDimExpr::get, py::arg("position"), in populateIRAffine()
625 py::arg("context") = py::none(), in populateIRAffine()
628 "get_symbol", &PyAffineSymbolExpr::get, py::arg("position"), in populateIRAffine()
629 py::arg("context") = py::none(), in populateIRAffine()
647 py::class_<PyAffineMap>(m, "AffineMap", py::module_local()) in populateIRAffine()
653 .def("__eq__", [](PyAffineMap &self, py::object &other) { return false; }) in populateIRAffine()
675 [](py::list affineMaps, DefaultingPyMlirContext context) { in populateIRAffine()
701 [](intptr_t dimCount, intptr_t symbolCount, py::list exprs, in populateIRAffine()
711 py::arg("dim_count"), py::arg("symbol_count"), py::arg("exprs"), in populateIRAffine()
712 py::arg("context") = py::none(), in populateIRAffine()
721 py::arg("value"), py::arg("context") = py::none(), in populateIRAffine()
729 py::arg("context") = py::none(), "Gets an empty affine map.") in populateIRAffine()
737 py::arg("n_dims"), py::arg("context") = py::none(), in populateIRAffine()
747 py::arg("n_dims"), py::arg("n_results"), in populateIRAffine()
748 py::arg("context") = py::none(), in populateIRAffine()
756 throw py::cast_error("Invalid permutation when attempting to " in populateIRAffine()
762 py::arg("permutation"), py::arg("context") = py::none(), in populateIRAffine()
770 throw py::value_error("result position out of bounds"); in populateIRAffine()
776 py::arg("result_positions")) in populateIRAffine()
781 throw py::value_error("number of results out of bounds"); in populateIRAffine()
786 py::arg("n_results")) in populateIRAffine()
791 throw py::value_error("number of results out of bounds"); in populateIRAffine()
796 py::arg("n_results")) in populateIRAffine()
806 py::arg("expr"), py::arg("replacement"), py::arg("n_result_dims"), in populateIRAffine()
807 py::arg("n_result_syms")) in populateIRAffine()
832 py::class_<PyIntegerSet>(m, "IntegerSet", py::module_local()) in populateIRAffine()
838 .def("__eq__", [](PyIntegerSet &self, py::object other) { return false; }) in populateIRAffine()
867 [](intptr_t numDims, intptr_t numSymbols, py::list exprs, in populateIRAffine()
870 throw py::value_error( in populateIRAffine()
874 throw py::value_error("Expected non-empty list of constraints"); in populateIRAffine()
889 py::arg("num_dims"), py::arg("num_symbols"), py::arg("exprs"), in populateIRAffine()
890 py::arg("eq_flags"), py::arg("context") = py::none()) in populateIRAffine()
899 py::arg("num_dims"), py::arg("num_symbols"), in populateIRAffine()
900 py::arg("context") = py::none()) in populateIRAffine()
903 [](PyIntegerSet &self, py::list dimExprs, py::list symbolExprs, in populateIRAffine()
907 throw py::value_error( in populateIRAffine()
912 throw py::value_error( in populateIRAffine()
928 py::arg("dim_exprs"), py::arg("symbol_exprs"), in populateIRAffine()
929 py::arg("num_result_dims"), py::arg("num_result_symbols")) in populateIRAffine()