gstaichi 0.1.20.dev0__cp310-cp310-macosx_15_0_arm64.whl → 0.1.25.dev0__cp310-cp310-macosx_15_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taichi → gstaichi}/__init__.py +9 -13
- {taichi → gstaichi}/_funcs.py +8 -8
- {taichi → gstaichi}/_kernels.py +19 -19
- gstaichi/_lib/__init__.py +3 -0
- taichi/_lib/core/taichi_python.cpython-310-darwin.so → gstaichi/_lib/core/gstaichi_python.cpython-310-darwin.so +0 -0
- taichi/_lib/core/taichi_python.pyi → gstaichi/_lib/core/gstaichi_python.pyi +382 -520
- {taichi → gstaichi}/_lib/runtime/runtime_arm64.bc +0 -0
- {taichi → gstaichi}/_lib/utils.py +15 -15
- {taichi → gstaichi}/_logging.py +1 -1
- {taichi → gstaichi}/_main.py +24 -31
- gstaichi/_snode/__init__.py +5 -0
- {taichi → gstaichi}/_snode/fields_builder.py +27 -29
- {taichi → gstaichi}/_snode/snode_tree.py +5 -5
- gstaichi/_test_tools/__init__.py +0 -0
- gstaichi/_test_tools/load_kernel_string.py +30 -0
- gstaichi/_version.py +1 -0
- {taichi → gstaichi}/_version_check.py +8 -5
- gstaichi/ad/__init__.py +3 -0
- {taichi → gstaichi}/ad/_ad.py +26 -26
- {taichi → gstaichi}/algorithms/_algorithms.py +7 -7
- {taichi → gstaichi}/examples/minimal.py +1 -1
- {taichi → gstaichi}/experimental.py +1 -1
- gstaichi/lang/__init__.py +50 -0
- {taichi → gstaichi}/lang/_ndarray.py +30 -26
- {taichi → gstaichi}/lang/_ndrange.py +8 -8
- gstaichi/lang/_template_mapper.py +199 -0
- {taichi → gstaichi}/lang/_texture.py +19 -19
- {taichi → gstaichi}/lang/_wrap_inspect.py +7 -7
- {taichi → gstaichi}/lang/any_array.py +13 -13
- {taichi → gstaichi}/lang/argpack.py +29 -29
- gstaichi/lang/ast/__init__.py +5 -0
- {taichi → gstaichi}/lang/ast/ast_transformer.py +94 -582
- {taichi → gstaichi}/lang/ast/ast_transformer_utils.py +54 -41
- gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
- gstaichi/lang/ast/ast_transformers/call_transformer.py +267 -0
- gstaichi/lang/ast/ast_transformers/function_def_transformer.py +320 -0
- {taichi → gstaichi}/lang/ast/checkers.py +5 -5
- gstaichi/lang/ast/transform.py +9 -0
- {taichi → gstaichi}/lang/common_ops.py +12 -12
- gstaichi/lang/exception.py +80 -0
- {taichi → gstaichi}/lang/expr.py +22 -22
- {taichi → gstaichi}/lang/field.py +29 -27
- {taichi → gstaichi}/lang/impl.py +116 -121
- {taichi → gstaichi}/lang/kernel_arguments.py +16 -16
- {taichi → gstaichi}/lang/kernel_impl.py +330 -363
- {taichi → gstaichi}/lang/matrix.py +119 -115
- {taichi → gstaichi}/lang/matrix_ops.py +6 -6
- {taichi → gstaichi}/lang/matrix_ops_utils.py +4 -4
- {taichi → gstaichi}/lang/mesh.py +22 -22
- {taichi → gstaichi}/lang/misc.py +39 -68
- {taichi → gstaichi}/lang/ops.py +146 -141
- {taichi → gstaichi}/lang/runtime_ops.py +2 -2
- {taichi → gstaichi}/lang/shell.py +3 -3
- {taichi → gstaichi}/lang/simt/__init__.py +1 -1
- {taichi → gstaichi}/lang/simt/block.py +7 -7
- {taichi → gstaichi}/lang/simt/grid.py +1 -1
- {taichi → gstaichi}/lang/simt/subgroup.py +1 -1
- {taichi → gstaichi}/lang/simt/warp.py +1 -1
- {taichi → gstaichi}/lang/snode.py +46 -44
- {taichi → gstaichi}/lang/source_builder.py +13 -13
- {taichi → gstaichi}/lang/struct.py +33 -33
- {taichi → gstaichi}/lang/util.py +24 -24
- gstaichi/linalg/__init__.py +8 -0
- {taichi → gstaichi}/linalg/matrixfree_cg.py +14 -14
- {taichi → gstaichi}/linalg/sparse_cg.py +10 -10
- {taichi → gstaichi}/linalg/sparse_matrix.py +23 -23
- {taichi → gstaichi}/linalg/sparse_solver.py +21 -21
- {taichi → gstaichi}/math/__init__.py +1 -1
- {taichi → gstaichi}/math/_complex.py +21 -20
- {taichi → gstaichi}/math/mathimpl.py +56 -56
- gstaichi/profiler/__init__.py +6 -0
- {taichi → gstaichi}/profiler/kernel_metrics.py +11 -11
- {taichi → gstaichi}/profiler/kernel_profiler.py +30 -36
- {taichi → gstaichi}/profiler/memory_profiler.py +1 -1
- {taichi → gstaichi}/profiler/scoped_profiler.py +2 -2
- {taichi → gstaichi}/sparse/_sparse_grid.py +7 -7
- {taichi → gstaichi}/tools/__init__.py +4 -4
- {taichi → gstaichi}/tools/diagnose.py +10 -17
- gstaichi/types/__init__.py +19 -0
- {taichi → gstaichi}/types/annotations.py +1 -1
- {taichi → gstaichi}/types/compound_types.py +8 -8
- {taichi → gstaichi}/types/enums.py +1 -1
- {taichi → gstaichi}/types/ndarray_type.py +7 -7
- {taichi → gstaichi}/types/primitive_types.py +17 -14
- {taichi → gstaichi}/types/quant.py +9 -9
- {taichi → gstaichi}/types/texture_type.py +5 -5
- {taichi → gstaichi}/types/utils.py +1 -1
- {gstaichi-0.1.20.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/METADATA +13 -16
- gstaichi-0.1.25.dev0.dist-info/RECORD +168 -0
- gstaichi-0.1.25.dev0.dist-info/entry_points.txt +2 -0
- gstaichi-0.1.25.dev0.dist-info/top_level.txt +1 -0
- gstaichi-0.1.20.dev0.dist-info/RECORD +0 -219
- gstaichi-0.1.20.dev0.dist-info/entry_points.txt +0 -2
- gstaichi-0.1.20.dev0.dist-info/top_level.txt +0 -1
- taichi/_lib/__init__.py +0 -3
- taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +0 -1401
- taichi/_lib/c_api/include/taichi/taichi.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_core.h +0 -1111
- taichi/_lib/c_api/include/taichi/taichi_cpu.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_metal.h +0 -72
- taichi/_lib/c_api/include/taichi/taichi_platform.h +0 -55
- taichi/_lib/c_api/include/taichi/taichi_unity.h +0 -64
- taichi/_lib/c_api/include/taichi/taichi_vulkan.h +0 -151
- taichi/_lib/c_api/lib/libtaichi_c_api.dylib +0 -0
- taichi/_lib/c_api/runtime/runtime_arm64.bc +0 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +0 -29
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +0 -65
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +0 -121
- taichi/_lib/runtime/libMoltenVK.dylib +0 -0
- taichi/_snode/__init__.py +0 -5
- taichi/_ti_module/__init__.py +0 -3
- taichi/_ti_module/cppgen.py +0 -309
- taichi/_ti_module/module.py +0 -145
- taichi/_version.py +0 -1
- taichi/ad/__init__.py +0 -3
- taichi/aot/__init__.py +0 -12
- taichi/aot/_export.py +0 -28
- taichi/aot/conventions/__init__.py +0 -3
- taichi/aot/conventions/gfxruntime140/__init__.py +0 -38
- taichi/aot/conventions/gfxruntime140/dr.py +0 -244
- taichi/aot/conventions/gfxruntime140/sr.py +0 -613
- taichi/aot/module.py +0 -253
- taichi/aot/utils.py +0 -151
- taichi/graph/__init__.py +0 -3
- taichi/graph/_graph.py +0 -292
- taichi/lang/__init__.py +0 -50
- taichi/lang/ast/__init__.py +0 -5
- taichi/lang/ast/transform.py +0 -9
- taichi/lang/exception.py +0 -80
- taichi/linalg/__init__.py +0 -8
- taichi/profiler/__init__.py +0 -6
- taichi/shaders/Circles_vk.frag +0 -29
- taichi/shaders/Circles_vk.vert +0 -45
- taichi/shaders/Circles_vk_frag.spv +0 -0
- taichi/shaders/Circles_vk_vert.spv +0 -0
- taichi/shaders/Lines_vk.frag +0 -9
- taichi/shaders/Lines_vk.vert +0 -11
- taichi/shaders/Lines_vk_frag.spv +0 -0
- taichi/shaders/Lines_vk_vert.spv +0 -0
- taichi/shaders/Mesh_vk.frag +0 -71
- taichi/shaders/Mesh_vk.vert +0 -68
- taichi/shaders/Mesh_vk_frag.spv +0 -0
- taichi/shaders/Mesh_vk_vert.spv +0 -0
- taichi/shaders/Particles_vk.frag +0 -95
- taichi/shaders/Particles_vk.vert +0 -73
- taichi/shaders/Particles_vk_frag.spv +0 -0
- taichi/shaders/Particles_vk_vert.spv +0 -0
- taichi/shaders/SceneLines2quad_vk_comp.spv +0 -0
- taichi/shaders/SceneLines_vk.frag +0 -9
- taichi/shaders/SceneLines_vk.vert +0 -12
- taichi/shaders/SceneLines_vk_frag.spv +0 -0
- taichi/shaders/SceneLines_vk_vert.spv +0 -0
- taichi/shaders/SetImage_vk.frag +0 -21
- taichi/shaders/SetImage_vk.vert +0 -15
- taichi/shaders/SetImage_vk_frag.spv +0 -0
- taichi/shaders/SetImage_vk_vert.spv +0 -0
- taichi/shaders/Triangles_vk.frag +0 -16
- taichi/shaders/Triangles_vk.vert +0 -29
- taichi/shaders/Triangles_vk_frag.spv +0 -0
- taichi/shaders/Triangles_vk_vert.spv +0 -0
- taichi/shaders/lines2quad_vk_comp.spv +0 -0
- taichi/types/__init__.py +0 -19
- {taichi → gstaichi}/__main__.py +0 -0
- {taichi → gstaichi}/_lib/core/__init__.py +0 -0
- {taichi → gstaichi}/_lib/core/py.typed +0 -0
- {taichi/_lib/c_api → gstaichi/_lib}/runtime/libMoltenVK.dylib +0 -0
- {taichi → gstaichi}/algorithms/__init__.py +0 -0
- {taichi → gstaichi}/assets/.git +0 -0
- {taichi → gstaichi}/assets/Go-Regular.ttf +0 -0
- {taichi → gstaichi}/assets/static/imgs/ti_gallery.png +0 -0
- {taichi → gstaichi}/lang/ast/symbol_resolver.py +0 -0
- {taichi → gstaichi}/sparse/__init__.py +0 -0
- {taichi → gstaichi}/tools/np2ply.py +0 -0
- {taichi → gstaichi}/tools/vtk.py +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3native.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/instrument.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/linker.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/optimizer.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/GLSL.std.450.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cfg.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_common.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cpp.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_c.h +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_containers.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_error_handling.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_util.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_glsl.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_hlsl.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_msl.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_parser.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_reflect.hpp +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Config.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/libSPIRV-Tools-shared.dylib +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +0 -0
- {gstaichi-0.1.20.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +0 -0
- {gstaichi-0.1.20.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/WHEEL +0 -0
- {gstaichi-0.1.20.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/licenses/LICENSE +0 -0
@@ -1,18 +1,18 @@
|
|
1
1
|
# type: ignore
|
2
2
|
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
8
|
-
from
|
3
|
+
from gstaichi._lib import core as _ti_core
|
4
|
+
from gstaichi.lang import impl
|
5
|
+
from gstaichi.lang.expr import Expr, make_expr_group
|
6
|
+
from gstaichi.lang.util import gstaichi_scope
|
7
|
+
from gstaichi.types.enums import Layout
|
8
|
+
from gstaichi.types.ndarray_type import NdarrayTypeMetadata
|
9
9
|
|
10
10
|
|
11
11
|
class AnyArray:
|
12
12
|
"""Class for arbitrary arrays in Python AST.
|
13
13
|
|
14
14
|
Args:
|
15
|
-
ptr (
|
15
|
+
ptr (gstaichi_python.Expr): A gstaichi_python.Expr wrapping a gstaichi_python.ExternalTensorExpression.
|
16
16
|
element_shape (Tuple[Int]): () if scalar elements (default), (n) if vector elements, and (n, m) if matrix elements.
|
17
17
|
layout (Layout): Memory layout.
|
18
18
|
"""
|
@@ -39,13 +39,13 @@ class AnyArray:
|
|
39
39
|
) # AnyArray can take any shape
|
40
40
|
|
41
41
|
@property
|
42
|
-
@
|
42
|
+
@gstaichi_scope
|
43
43
|
def grad(self):
|
44
44
|
"""Returns the gradient of this array."""
|
45
45
|
return AnyArray(_ti_core.make_external_tensor_grad_expr(self.ptr))
|
46
46
|
|
47
47
|
@property
|
48
|
-
@
|
48
|
+
@gstaichi_scope
|
49
49
|
def shape(self):
|
50
50
|
"""A list containing sizes for each dimension. Note that element shape will be excluded.
|
51
51
|
|
@@ -56,12 +56,12 @@ class AnyArray:
|
|
56
56
|
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
57
57
|
return [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr, i, dbg_info)) for i in range(dim)]
|
58
58
|
|
59
|
-
@
|
59
|
+
@gstaichi_scope
|
60
60
|
def _loop_range(self):
|
61
|
-
"""Gets the corresponding
|
61
|
+
"""Gets the corresponding gstaichi_python.Expr to serve as loop range.
|
62
62
|
|
63
63
|
Returns:
|
64
|
-
|
64
|
+
gstaichi_python.Expr: See above.
|
65
65
|
"""
|
66
66
|
return self.ptr
|
67
67
|
|
@@ -78,7 +78,7 @@ class AnyArrayAccess:
|
|
78
78
|
self.arr = arr
|
79
79
|
self.indices_first = indices_first
|
80
80
|
|
81
|
-
@
|
81
|
+
@gstaichi_scope
|
82
82
|
def subscript(self, i, j):
|
83
83
|
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
|
84
84
|
|
@@ -2,24 +2,24 @@
|
|
2
2
|
|
3
3
|
import numpy as np
|
4
4
|
|
5
|
-
import
|
6
|
-
from
|
7
|
-
from
|
8
|
-
from
|
9
|
-
|
10
|
-
|
5
|
+
import gstaichi.lang
|
6
|
+
from gstaichi._lib import core as _ti_core
|
7
|
+
from gstaichi.lang import impl, ops
|
8
|
+
from gstaichi.lang.exception import (
|
9
|
+
GsTaichiRuntimeTypeError,
|
10
|
+
GsTaichiSyntaxError,
|
11
11
|
)
|
12
|
-
from
|
13
|
-
from
|
14
|
-
from
|
15
|
-
from
|
12
|
+
from gstaichi.lang.matrix import Matrix, MatrixType
|
13
|
+
from gstaichi.lang.struct import Struct, StructType
|
14
|
+
from gstaichi.lang.util import cook_dtype, in_python_scope, python_scope
|
15
|
+
from gstaichi.types import (
|
16
16
|
ndarray_type,
|
17
17
|
primitive_types,
|
18
18
|
sparse_matrix_builder,
|
19
19
|
texture_type,
|
20
20
|
)
|
21
|
-
from
|
22
|
-
from
|
21
|
+
from gstaichi.types.compound_types import CompoundType
|
22
|
+
from gstaichi.types.utils import is_signed
|
23
23
|
|
24
24
|
|
25
25
|
class ArgPack:
|
@@ -27,7 +27,7 @@ class ArgPack:
|
|
27
27
|
|
28
28
|
The `ArgPack` operates as a dictionary-like data pack, storing members as (key, value) pairs. Members stored can
|
29
29
|
range from scalars and matrices to other dictionary-like structures. Distinguished from structs, `ArgPack` can
|
30
|
-
accommodate buffer types such as `NdarrayType` and `TextureType` from
|
30
|
+
accommodate buffer types such as `NdarrayType` and `TextureType` from GsTaichi. However, unlike `ti.Struct` which
|
31
31
|
serves as a data container, `ArgPack` functions as a reference container. It's important to note that `ArgPack`
|
32
32
|
cannot be nested within other types except for another `ArgPack`, and can only be utilized as kernel parameters.
|
33
33
|
|
@@ -60,11 +60,11 @@ class ArgPack:
|
|
60
60
|
elif len(args) == 0:
|
61
61
|
self.__entries = kwargs
|
62
62
|
else:
|
63
|
-
raise
|
63
|
+
raise GsTaichiSyntaxError(
|
64
64
|
"Custom argument packs need to be initialized using either dictionary or keyword arguments"
|
65
65
|
)
|
66
66
|
if annotations.keys() != self.__entries.keys():
|
67
|
-
raise
|
67
|
+
raise GsTaichiSyntaxError("ArgPack annotations keys not equals to entries keys.")
|
68
68
|
self.__annotations = annotations
|
69
69
|
for k, v in self.__entries.items():
|
70
70
|
self.__entries[k] = v if in_python_scope() else impl.expr_init(v)
|
@@ -198,28 +198,28 @@ class ArgPack:
|
|
198
198
|
def _write_to_device(self, needed, provided, v, index):
|
199
199
|
if isinstance(needed, ArgPackType):
|
200
200
|
if not isinstance(v, ArgPack):
|
201
|
-
raise
|
201
|
+
raise GsTaichiRuntimeTypeError.get(index, str(needed), str(provided))
|
202
202
|
self.__argpack.set_arg_nested_argpack(index, v.__argpack)
|
203
203
|
else:
|
204
204
|
# Note: do not use sth like "needed == f32". That would be slow.
|
205
205
|
if id(needed) in primitive_types.real_type_ids:
|
206
206
|
if not isinstance(v, (float, int, np.floating, np.integer)):
|
207
|
-
raise
|
207
|
+
raise GsTaichiRuntimeTypeError.get(index, needed.to_string(), provided)
|
208
208
|
self.__argpack.set_arg_float((index,), float(v))
|
209
209
|
elif id(needed) in primitive_types.integer_type_ids:
|
210
210
|
if not isinstance(v, (int, np.integer)):
|
211
|
-
raise
|
211
|
+
raise GsTaichiRuntimeTypeError.get(index, needed.to_string(), provided)
|
212
212
|
if is_signed(cook_dtype(needed)):
|
213
213
|
self.__argpack.set_arg_int((index,), int(v))
|
214
214
|
else:
|
215
215
|
self.__argpack.set_arg_uint((index,), int(v))
|
216
216
|
elif isinstance(needed, sparse_matrix_builder):
|
217
217
|
pass
|
218
|
-
elif isinstance(needed, ndarray_type.NdarrayType) and isinstance(v,
|
218
|
+
elif isinstance(needed, ndarray_type.NdarrayType) and isinstance(v, gstaichi.lang._ndarray.Ndarray):
|
219
219
|
pass
|
220
|
-
elif isinstance(needed, texture_type.TextureType) and isinstance(v,
|
220
|
+
elif isinstance(needed, texture_type.TextureType) and isinstance(v, gstaichi.lang._texture.Texture):
|
221
221
|
pass
|
222
|
-
elif isinstance(needed, texture_type.RWTextureType) and isinstance(v,
|
222
|
+
elif isinstance(needed, texture_type.RWTextureType) and isinstance(v, gstaichi.lang._texture.Texture):
|
223
223
|
pass
|
224
224
|
elif isinstance(needed, ndarray_type.NdarrayType):
|
225
225
|
pass
|
@@ -228,14 +228,14 @@ class ArgPack:
|
|
228
228
|
|
229
229
|
def cast_func(x):
|
230
230
|
if not isinstance(x, (int, float, np.integer, np.floating)):
|
231
|
-
raise
|
231
|
+
raise GsTaichiRuntimeTypeError.get(index, needed.dtype.to_string(), type(x))
|
232
232
|
return float(x)
|
233
233
|
|
234
234
|
elif needed.dtype in primitive_types.integer_types:
|
235
235
|
|
236
236
|
def cast_func(x):
|
237
237
|
if not isinstance(x, (int, np.integer)):
|
238
|
-
raise
|
238
|
+
raise GsTaichiRuntimeTypeError.get(index, needed.dtype.to_string(), type(x))
|
239
239
|
return int(x)
|
240
240
|
|
241
241
|
else:
|
@@ -249,7 +249,7 @@ class ArgPack:
|
|
249
249
|
needed.set_argpack_struct_args(v, self.__argpack, (index,))
|
250
250
|
elif isinstance(needed, StructType):
|
251
251
|
if not isinstance(v, needed):
|
252
|
-
raise
|
252
|
+
raise GsTaichiRuntimeTypeError.get(index, str(needed), provided)
|
253
253
|
needed.set_argpack_struct_args(v, self.__argpack, (index,))
|
254
254
|
else:
|
255
255
|
raise ValueError(f"Argument type mismatch. Expecting {needed}, got {type(v)}.")
|
@@ -270,11 +270,11 @@ class _IntermediateArgPack(ArgPack):
|
|
270
270
|
elif len(args) == 0:
|
271
271
|
self._ArgPack__entries = kwargs
|
272
272
|
else:
|
273
|
-
raise
|
273
|
+
raise GsTaichiSyntaxError(
|
274
274
|
"Custom argument packs need to be initialized using either dictionary or keyword arguments"
|
275
275
|
)
|
276
276
|
if annotations.keys() != self._ArgPack__entries.keys():
|
277
|
-
raise
|
277
|
+
raise GsTaichiSyntaxError("ArgPack annotations keys not equals to entries keys.")
|
278
278
|
self._ArgPack__annotations = annotations
|
279
279
|
self._register_members()
|
280
280
|
self._ArgPack__dtype = dtype
|
@@ -296,7 +296,7 @@ class ArgPackType(CompoundType):
|
|
296
296
|
self.members[k] = dtype
|
297
297
|
elements.append(
|
298
298
|
[
|
299
|
-
_ti_core.
|
299
|
+
_ti_core.DataTypeCxx(
|
300
300
|
_ti_core.get_type_factory_instance().get_struct_type_for_argpack_ptr(dtype.dtype)
|
301
301
|
),
|
302
302
|
k,
|
@@ -366,7 +366,7 @@ class ArgPackType(CompoundType):
|
|
366
366
|
def cast(self, pack):
|
367
367
|
# sanity check members
|
368
368
|
if self.members.keys() != pack._ArgPack__entries.keys():
|
369
|
-
raise
|
369
|
+
raise GsTaichiSyntaxError("Incompatible arguments for custom argument pack members!")
|
370
370
|
entries = {}
|
371
371
|
for k, dtype in self.members.items():
|
372
372
|
if isinstance(dtype, MatrixType):
|
@@ -392,7 +392,7 @@ class ArgPackType(CompoundType):
|
|
392
392
|
pack = ArgPack(self.members, self.dtype, entries)
|
393
393
|
return pack
|
394
394
|
|
395
|
-
def
|
395
|
+
def from_gstaichi_object(self, arg_load_dict: dict):
|
396
396
|
d = {}
|
397
397
|
items = self.members.items()
|
398
398
|
for index, pair in enumerate(items):
|