kumi 0.0.30 → 0.0.33
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -1
- data/README.md +31 -99
- data/data/kernels/ruby/core/arithmetic.yaml +2 -2
- data/docs/COMPOSED_SCHEMAS.md +137 -0
- data/docs/SCHEMA_IMPORTS.md +275 -0
- data/docs/SYNTAX.md +48 -0
- data/golden/array_element/expected/schema_ruby.rb +2 -27
- data/golden/array_index/expected/nast.txt +6 -6
- data/golden/array_index/expected/schema_ruby.rb +4 -31
- data/golden/array_operations/expected/lir_06_const_prop.txt +4 -8
- data/golden/array_operations/expected/schema_javascript.mjs +4 -8
- data/golden/array_operations/expected/schema_ruby.rb +10 -43
- data/golden/cascade_logic/expected/lir_06_const_prop.txt +7 -14
- data/golden/cascade_logic/expected/schema_javascript.mjs +7 -14
- data/golden/cascade_logic/expected/schema_ruby.rb +11 -45
- data/golden/chained_fusion/expected/lir_06_const_prop.txt +8 -18
- data/golden/chained_fusion/expected/schema_javascript.mjs +8 -18
- data/golden/chained_fusion/expected/schema_ruby.rb +14 -53
- data/golden/decimal_explicit/expected/schema_ruby.rb +4 -31
- data/golden/element_arrays/expected/lir_06_const_prop.txt +5 -11
- data/golden/element_arrays/expected/schema_javascript.mjs +5 -11
- data/golden/element_arrays/expected/schema_ruby.rb +13 -50
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +4 -31
- data/golden/example_xpto/expected/ast.txt +23 -0
- data/golden/example_xpto/expected/input_plan.txt +1 -0
- data/golden/example_xpto/expected/lir_00_unoptimized.txt +16 -0
- data/golden/example_xpto/expected/lir_01_hoist_scalar_references.txt +16 -0
- data/golden/example_xpto/expected/lir_02_inlined.txt +16 -0
- data/golden/example_xpto/expected/lir_03_cse.txt +16 -0
- data/golden/example_xpto/expected/lir_04_1_loop_fusion.txt +16 -0
- data/golden/example_xpto/expected/lir_04_loop_invcm.txt +16 -0
- data/golden/example_xpto/expected/lir_06_const_prop.txt +13 -0
- data/golden/example_xpto/expected/nast.txt +17 -0
- data/golden/example_xpto/expected/schema_javascript.mjs +13 -0
- data/golden/example_xpto/expected/schema_ruby.rb +13 -0
- data/golden/example_xpto/expected/snast.txt +17 -0
- data/golden/example_xpto/expected.json +4 -0
- data/golden/example_xpto/input.json +3 -0
- data/golden/example_xpto/schema.kumi +8 -0
- data/golden/function_overload/expected/schema_ruby.rb +2 -27
- data/golden/game_of_life/expected/lir_06_const_prop.txt +236 -287
- data/golden/game_of_life/expected/schema_javascript.mjs +32 -39
- data/golden/game_of_life/expected/schema_ruby.rb +34 -66
- data/golden/hash_keys/expected/lir_06_const_prop.txt +4 -10
- data/golden/hash_keys/expected/schema_javascript.mjs +6 -12
- data/golden/hash_keys/expected/schema_ruby.rb +8 -39
- data/golden/hash_value/expected/lir_06_const_prop.txt +3 -6
- data/golden/hash_value/expected/schema_javascript.mjs +3 -6
- data/golden/hash_value/expected/schema_ruby.rb +7 -37
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +9 -18
- data/golden/hierarchical_complex/expected/schema_javascript.mjs +9 -18
- data/golden/hierarchical_complex/expected/schema_ruby.rb +14 -51
- data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +7 -39
- data/golden/input_reference/expected/schema_ruby.rb +6 -35
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +6 -14
- data/golden/interleaved_fusion/expected/schema_javascript.mjs +6 -14
- data/golden/interleaved_fusion/expected/schema_ruby.rb +11 -47
- data/golden/let_inline/expected/lir_06_const_prop.txt +1 -2
- data/golden/let_inline/expected/schema_javascript.mjs +1 -2
- data/golden/let_inline/expected/schema_ruby.rb +3 -29
- data/golden/loop_fusion/expected/lir_06_const_prop.txt +4 -10
- data/golden/loop_fusion/expected/schema_javascript.mjs +4 -10
- data/golden/loop_fusion/expected/schema_ruby.rb +8 -41
- data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +3 -6
- data/golden/min_reduce_scope/expected/schema_javascript.mjs +3 -6
- data/golden/min_reduce_scope/expected/schema_ruby.rb +8 -39
- data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +1 -2
- data/golden/mixed_dimensions/expected/schema_javascript.mjs +1 -2
- data/golden/mixed_dimensions/expected/schema_ruby.rb +5 -33
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +9 -18
- data/golden/multirank_hoisting/expected/schema_javascript.mjs +9 -18
- data/golden/multirank_hoisting/expected/schema_ruby.rb +16 -55
- data/golden/nested_hash/expected/lir_06_const_prop.txt +1 -2
- data/golden/nested_hash/expected/schema_javascript.mjs +1 -2
- data/golden/nested_hash/expected/schema_ruby.rb +3 -29
- data/golden/reduction_broadcast/expected/schema_ruby.rb +5 -33
- data/golden/roll/expected/lir_06_const_prop.txt +8 -15
- data/golden/roll/expected/schema_javascript.mjs +8 -15
- data/golden/roll/expected/schema_ruby.rb +13 -48
- data/golden/schema_imports_broadcasting_with_imports/expected/ast.txt +26 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/input_plan.txt +5 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_00_unoptimized.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_01_hoist_scalar_references.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_02_inlined.txt +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_03_cse.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_1_loop_fusion.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_loop_invcm.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_06_const_prop.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/nast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_javascript.mjs +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_ruby.rb +24 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/snast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected.json +4 -0
- data/golden/schema_imports_broadcasting_with_imports/input.json +7 -0
- data/golden/schema_imports_broadcasting_with_imports/schema.kumi +14 -0
- data/golden/schema_imports_complex_order_calc/expected/ast.txt +82 -0
- data/golden/schema_imports_complex_order_calc/expected/input_plan.txt +16 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_00_unoptimized.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_01_hoist_scalar_references.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_02_inlined.txt +187 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_03_cse.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_1_loop_fusion.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_loop_invcm.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_06_const_prop.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/nast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_javascript.mjs +147 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_ruby.rb +149 -0
- data/golden/schema_imports_complex_order_calc/expected/snast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected.json +12 -0
- data/golden/schema_imports_complex_order_calc/input.json +20 -0
- data/golden/schema_imports_complex_order_calc/schema.kumi +33 -0
- data/golden/schema_imports_composed_order/expected/ast.txt +33 -0
- data/golden/schema_imports_composed_order/expected/input_plan.txt +3 -0
- data/golden/schema_imports_composed_order/expected/lir_00_unoptimized.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_01_hoist_scalar_references.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_02_inlined.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_03_cse.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_1_loop_fusion.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_loop_invcm.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_06_const_prop.txt +33 -0
- data/golden/schema_imports_composed_order/expected/nast.txt +25 -0
- data/golden/schema_imports_composed_order/expected/schema_javascript.mjs +35 -0
- data/golden/schema_imports_composed_order/expected/schema_ruby.rb +33 -0
- data/golden/schema_imports_composed_order/expected/snast.txt +25 -0
- data/golden/schema_imports_composed_order/expected.json +6 -0
- data/golden/schema_imports_composed_order/input.json +5 -0
- data/golden/schema_imports_composed_order/schema.kumi +15 -0
- data/golden/schema_imports_discount_with_tax/expected/ast.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/input_plan.txt +2 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_00_unoptimized.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_02_inlined.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_03_cse.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_1_loop_fusion.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_loop_invcm.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_06_const_prop.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/nast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_javascript.mjs +37 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_ruby.rb +34 -0
- data/golden/schema_imports_discount_with_tax/expected/snast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected.json +7 -0
- data/golden/schema_imports_discount_with_tax/input.json +4 -0
- data/golden/schema_imports_discount_with_tax/schema.kumi +15 -0
- data/golden/schema_imports_line_items/expected/ast.txt +35 -0
- data/golden/schema_imports_line_items/expected/input_plan.txt +8 -0
- data/golden/schema_imports_line_items/expected/lir_00_unoptimized.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_01_hoist_scalar_references.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_02_inlined.txt +24 -0
- data/golden/schema_imports_line_items/expected/lir_03_cse.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_1_loop_fusion.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_loop_invcm.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_06_const_prop.txt +22 -0
- data/golden/schema_imports_line_items/expected/nast.txt +19 -0
- data/golden/schema_imports_line_items/expected/schema_javascript.mjs +23 -0
- data/golden/schema_imports_line_items/expected/schema_ruby.rb +22 -0
- data/golden/schema_imports_line_items/expected/snast.txt +19 -0
- data/golden/schema_imports_line_items/expected.json +5 -0
- data/golden/schema_imports_line_items/input.json +13 -0
- data/golden/schema_imports_line_items/schema.kumi +17 -0
- data/golden/schema_imports_multiple/expected/ast.txt +35 -0
- data/golden/schema_imports_multiple/expected/input_plan.txt +2 -0
- data/golden/schema_imports_multiple/expected/lir_00_unoptimized.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_01_hoist_scalar_references.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_02_inlined.txt +41 -0
- data/golden/schema_imports_multiple/expected/lir_03_cse.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_1_loop_fusion.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_loop_invcm.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_06_const_prop.txt +37 -0
- data/golden/schema_imports_multiple/expected/nast.txt +28 -0
- data/golden/schema_imports_multiple/expected/schema_javascript.mjs +40 -0
- data/golden/schema_imports_multiple/expected/schema_ruby.rb +37 -0
- data/golden/schema_imports_multiple/expected/snast.txt +28 -0
- data/golden/schema_imports_multiple/expected.json +7 -0
- data/golden/schema_imports_multiple/input.json +4 -0
- data/golden/schema_imports_multiple/schema.kumi +15 -0
- data/golden/schema_imports_nested_expressions/expected/ast.txt +31 -0
- data/golden/schema_imports_nested_expressions/expected/input_plan.txt +3 -0
- data/golden/schema_imports_nested_expressions/expected/lir_00_unoptimized.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_01_hoist_scalar_references.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_02_inlined.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_03_cse.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_1_loop_fusion.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_loop_invcm.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_06_const_prop.txt +28 -0
- data/golden/schema_imports_nested_expressions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected/schema_javascript.mjs +29 -0
- data/golden/schema_imports_nested_expressions/expected/schema_ruby.rb +28 -0
- data/golden/schema_imports_nested_expressions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected.json +5 -0
- data/golden/schema_imports_nested_expressions/input.json +5 -0
- data/golden/schema_imports_nested_expressions/schema.kumi +13 -0
- data/golden/schema_imports_nested_with_reductions/expected/ast.txt +47 -0
- data/golden/schema_imports_nested_with_reductions/expected/input_plan.txt +12 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_00_unoptimized.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_02_inlined.txt +58 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_03_cse.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_1_loop_fusion.txt +51 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_06_const_prop.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_javascript.mjs +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_ruby.rb +52 -0
- data/golden/schema_imports_nested_with_reductions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected.json +6 -0
- data/golden/schema_imports_nested_with_reductions/input.json +16 -0
- data/golden/schema_imports_nested_with_reductions/schema.kumi +23 -0
- data/golden/schema_imports_with_imports/expected/ast.txt +19 -0
- data/golden/schema_imports_with_imports/expected/input_plan.txt +1 -0
- data/golden/schema_imports_with_imports/expected/lir_00_unoptimized.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_01_hoist_scalar_references.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_02_inlined.txt +14 -0
- data/golden/schema_imports_with_imports/expected/lir_03_cse.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_1_loop_fusion.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_loop_invcm.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_06_const_prop.txt +13 -0
- data/golden/schema_imports_with_imports/expected/nast.txt +13 -0
- data/golden/schema_imports_with_imports/expected/schema_javascript.mjs +13 -0
- data/golden/schema_imports_with_imports/expected/schema_ruby.rb +13 -0
- data/golden/schema_imports_with_imports/expected/snast.txt +13 -0
- data/golden/schema_imports_with_imports/expected.json +4 -0
- data/golden/schema_imports_with_imports/input.json +3 -0
- data/golden/schema_imports_with_imports/schema.kumi +10 -0
- data/golden/shift/expected/lir_06_const_prop.txt +18 -30
- data/golden/shift/expected/schema_javascript.mjs +18 -30
- data/golden/shift/expected/schema_ruby.rb +25 -67
- data/golden/shift_2d/expected/lir_06_const_prop.txt +36 -60
- data/golden/shift_2d/expected/schema_javascript.mjs +36 -60
- data/golden/shift_2d/expected/schema_ruby.rb +49 -109
- data/golden/simple_math/expected/lir_06_const_prop.txt +3 -6
- data/golden/simple_math/expected/schema_javascript.mjs +3 -6
- data/golden/simple_math/expected/schema_ruby.rb +8 -39
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +6 -12
- data/golden/streaming_basics/expected/schema_javascript.mjs +6 -12
- data/golden/streaming_basics/expected/schema_ruby.rb +14 -51
- data/golden/tuples/expected/lir_06_const_prop.txt +5 -22
- data/golden/tuples/expected/schema_javascript.mjs +5 -22
- data/golden/tuples/expected/schema_ruby.rb +11 -57
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +4 -8
- data/golden/tuples_and_arrays/expected/schema_javascript.mjs +4 -8
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +9 -41
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +94 -171
- data/golden/us_tax_2024/expected/schema_javascript.mjs +13 -21
- data/golden/us_tax_2024/expected/schema_ruby.rb +15 -48
- data/golden/with_constants/expected/lir_06_const_prop.txt +3 -8
- data/golden/with_constants/expected/schema_javascript.mjs +3 -8
- data/golden/with_constants/expected/schema_ruby.rb +5 -35
- data/lib/kumi/analyzer.rb +8 -7
- data/lib/kumi/configuration.rb +7 -6
- data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +20 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +16 -7
- data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +3 -35
- data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +6 -0
- data/lib/kumi/core/analyzer/passes/import_analysis_pass.rb +90 -0
- data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +77 -36
- data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +26 -11
- data/lib/kumi/core/analyzer/passes/name_indexer.rb +20 -2
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +44 -0
- data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +30 -0
- data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -1
- data/lib/kumi/core/analyzer/passes/snast_pass.rb +15 -0
- data/lib/kumi/core/lir/build.rb +27 -0
- data/lib/kumi/core/lir/peephole.rb +164 -0
- data/lib/kumi/core/nast.rb +16 -0
- data/lib/kumi/core/ruby_parser/build_context.rb +3 -1
- data/lib/kumi/core/ruby_parser/parser.rb +1 -1
- data/lib/kumi/core/ruby_parser/schema_builder.rb +33 -3
- data/lib/kumi/dev/golden/result.rb +9 -3
- data/lib/kumi/dev/golden/runtime_test.rb +16 -1
- data/lib/kumi/dev/golden.rb +18 -20
- data/lib/kumi/dev/golden_schema_modules.rb +8 -0
- data/lib/kumi/dev/golden_schema_wrapper.rb +116 -0
- data/lib/kumi/dev/support/kumi_runner.mjs +18 -0
- data/lib/kumi/schema.rb +44 -2
- data/lib/kumi/support/lir_printer.rb +21 -5
- data/lib/kumi/support/nast_printer.rb +11 -0
- data/lib/kumi/support/s_expression_printer.rb +9 -0
- data/lib/kumi/support/snast_printer.rb +6 -0
- data/lib/kumi/syntax/import_call.rb +11 -0
- data/lib/kumi/syntax/import_declaration.rb +11 -0
- data/lib/kumi/syntax/root.rb +2 -2
- data/lib/kumi/test_shared_schemas/compound.rb +21 -0
- data/lib/kumi/test_shared_schemas/discount.rb +19 -0
- data/lib/kumi/test_shared_schemas/price.rb +19 -0
- data/lib/kumi/test_shared_schemas/subtotal.rb +22 -0
- data/lib/kumi/test_shared_schemas/tax.rb +18 -0
- data/lib/kumi/version.rb +1 -1
- data/lib/kumi.rb +19 -4
- metadata +176 -3
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :distance then _distance
|
|
24
|
-
else raise KeyError, "Unknown declaration"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def _distance(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_2c69a8e57279887f52452ee206859309594ffecf44f4962a3d7ee0619b808d64
|
|
3
|
+
def self._distance(input)
|
|
29
4
|
t22 = input["x"] || input[:x]
|
|
30
5
|
t24 = t22 * t22
|
|
31
6
|
t25 = input["y"] || input[:y]
|
|
32
7
|
t27 = t25 * t25
|
|
33
8
|
t21 = t24 + t27
|
|
34
|
-
|
|
35
|
-
t21 ** t11
|
|
9
|
+
t21 ** 0.5
|
|
36
10
|
end
|
|
37
11
|
end
|
|
@@ -14,16 +14,13 @@
|
|
|
14
14
|
)
|
|
15
15
|
(Declaration manager_count
|
|
16
16
|
%t10 = load_input "departments" :: array
|
|
17
|
-
%t18 = const "manager" :: string
|
|
18
|
-
%t20 = const 1 :: integer
|
|
19
|
-
%t21 = const 0 :: integer
|
|
20
17
|
loop departments id=L3 in %t10 as el=%departments_el_11, idx=%departments_i_12
|
|
21
18
|
%acc_13 = decl_acc :: integer
|
|
22
19
|
%t14 = load_field departments_el_11["employees"] :: any
|
|
23
20
|
loop employees id=L4 in %t14 as el=%employees_el_15, idx=%employees_i_16
|
|
24
21
|
%t17 = load_field employees_el_15["role"] :: string
|
|
25
|
-
%t19 = call core.eq(%t17,
|
|
26
|
-
%t22 = select %t19,
|
|
22
|
+
%t19 = call core.eq(%t17, "manager") :: boolean
|
|
23
|
+
%t22 = select %t19, 1, 0 :: integer
|
|
27
24
|
%acc_13 = acc_add agg.sum(%acc_13, %t22) :: integer
|
|
28
25
|
end_loop
|
|
29
26
|
%t23 = acc_load %acc_13 :: integer
|
|
@@ -32,9 +29,6 @@
|
|
|
32
29
|
)
|
|
33
30
|
(Declaration department_summary
|
|
34
31
|
%t24 = load_input "departments" :: array
|
|
35
|
-
%t46 = const "manager" :: string
|
|
36
|
-
%t48 = const 1 :: integer
|
|
37
|
-
%t49 = const 0 :: integer
|
|
38
32
|
loop departments id=L5 in %t24 as el=%departments_el_25, idx=%departments_i_26
|
|
39
33
|
%t27 = load_field departments_el_25["name"] :: string
|
|
40
34
|
%acc33 = decl_acc :: integer
|
|
@@ -44,8 +38,8 @@
|
|
|
44
38
|
%t37 = load_field t35["salary"] :: integer
|
|
45
39
|
%acc33 = acc_add agg.sum(%acc33, %t37) :: integer
|
|
46
40
|
%t45 = load_field t35["role"] :: string
|
|
47
|
-
%t47 = call core.eq(%t45,
|
|
48
|
-
%t50 = select %t47,
|
|
41
|
+
%t47 = call core.eq(%t45, "manager") :: boolean
|
|
42
|
+
%t50 = select %t47, 1, 0 :: integer
|
|
49
43
|
%acc41 = acc_add agg.sum(%acc41, %t50) :: integer
|
|
50
44
|
end_loop
|
|
51
45
|
%t38 = acc_load %acc33 :: integer
|
|
@@ -16,16 +16,13 @@ export function _total_payroll(input) {
|
|
|
16
16
|
export function _manager_count(input) {
|
|
17
17
|
let out = [];
|
|
18
18
|
let t10 = input["departments"];
|
|
19
|
-
const t18 = "manager";
|
|
20
|
-
const t20 = 1;
|
|
21
|
-
const t21 = 0;
|
|
22
19
|
t10.forEach((departments_el_11, departments_i_12) => {
|
|
23
20
|
let acc_13 = 0;
|
|
24
21
|
let t14 = departments_el_11["employees"];
|
|
25
22
|
t14.forEach((employees_el_15, employees_i_16) => {
|
|
26
23
|
let t17 = employees_el_15["role"];
|
|
27
|
-
let t19 = t17 ==
|
|
28
|
-
let t22 = t19 ?
|
|
24
|
+
let t19 = t17 == "manager";
|
|
25
|
+
let t22 = t19 ? 1 : 0;
|
|
29
26
|
acc_13 += t22;
|
|
30
27
|
});
|
|
31
28
|
out.push(acc_13);
|
|
@@ -36,9 +33,6 @@ export function _manager_count(input) {
|
|
|
36
33
|
export function _department_summary(input) {
|
|
37
34
|
let out = [];
|
|
38
35
|
let t24 = input["departments"];
|
|
39
|
-
const t46 = "manager";
|
|
40
|
-
const t48 = 1;
|
|
41
|
-
const t49 = 0;
|
|
42
36
|
t24.forEach((departments_el_25, departments_i_26) => {
|
|
43
37
|
let t27 = departments_el_25["name"];
|
|
44
38
|
let acc33 = 0;
|
|
@@ -48,8 +42,8 @@ export function _department_summary(input) {
|
|
|
48
42
|
let t37 = t35["salary"];
|
|
49
43
|
acc33 += t37;
|
|
50
44
|
let t45 = t35["role"];
|
|
51
|
-
let t47 = t45 ==
|
|
52
|
-
let t50 = t47 ?
|
|
45
|
+
let t47 = t45 == "manager";
|
|
46
|
+
let t50 = t47 ? 1 : 0;
|
|
53
47
|
acc41 += t50;
|
|
54
48
|
});
|
|
55
49
|
let t30 = {
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :total_payroll then _total_payroll
|
|
24
|
-
when :manager_count then _manager_count
|
|
25
|
-
when :department_summary then _department_summary
|
|
26
|
-
else raise KeyError, "Unknown declaration"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def _total_payroll(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_8d8e257c8633e479e3863a9e5834fcae71aa112b955fe30f1dd9ee0bc536ac7a
|
|
3
|
+
def self._total_payroll(input)
|
|
31
4
|
out = []
|
|
32
5
|
t1 = input["departments"] || input[:departments]
|
|
33
6
|
t1.each_with_index do |departments_el_2, departments_i_3|
|
|
@@ -43,19 +16,16 @@ module Kumi::Compiled::KUMI_be7f942a1922a7234acbdd6dfbe63e3125a7ea18ddada895403f
|
|
|
43
16
|
out
|
|
44
17
|
end
|
|
45
18
|
|
|
46
|
-
def _manager_count(input
|
|
19
|
+
def self._manager_count(input)
|
|
47
20
|
out = []
|
|
48
21
|
t10 = input["departments"] || input[:departments]
|
|
49
|
-
t18 = "manager"
|
|
50
|
-
t20 = 1
|
|
51
|
-
t21 = 0
|
|
52
22
|
t10.each_with_index do |departments_el_11, departments_i_12|
|
|
53
23
|
acc_13 = 0
|
|
54
24
|
t14 = departments_el_11["employees"] || departments_el_11[:employees]
|
|
55
25
|
t14.each_with_index do |employees_el_15, employees_i_16|
|
|
56
26
|
t17 = employees_el_15["role"] || employees_el_15[:role]
|
|
57
|
-
t19 = t17 ==
|
|
58
|
-
t22 = t19 ?
|
|
27
|
+
t19 = t17 == "manager"
|
|
28
|
+
t22 = t19 ? 1 : 0
|
|
59
29
|
acc_13 += t22
|
|
60
30
|
end
|
|
61
31
|
t23 = acc_13
|
|
@@ -64,12 +34,9 @@ module Kumi::Compiled::KUMI_be7f942a1922a7234acbdd6dfbe63e3125a7ea18ddada895403f
|
|
|
64
34
|
out
|
|
65
35
|
end
|
|
66
36
|
|
|
67
|
-
def _department_summary(input
|
|
37
|
+
def self._department_summary(input)
|
|
68
38
|
out = []
|
|
69
39
|
t24 = input["departments"] || input[:departments]
|
|
70
|
-
t46 = "manager"
|
|
71
|
-
t48 = 1
|
|
72
|
-
t49 = 0
|
|
73
40
|
t24.each_with_index do |departments_el_25, departments_i_26|
|
|
74
41
|
t27 = departments_el_25["name"] || departments_el_25[:name]
|
|
75
42
|
acc33 = 0
|
|
@@ -79,8 +46,8 @@ module Kumi::Compiled::KUMI_be7f942a1922a7234acbdd6dfbe63e3125a7ea18ddada895403f
|
|
|
79
46
|
t37 = t35["salary"] || t35[:salary]
|
|
80
47
|
acc33 += t37
|
|
81
48
|
t45 = t35["role"] || t35[:role]
|
|
82
|
-
t47 = t45 ==
|
|
83
|
-
t50 = t47 ?
|
|
49
|
+
t47 = t45 == "manager"
|
|
50
|
+
t50 = t47 ? 1 : 0
|
|
84
51
|
acc41 += t50
|
|
85
52
|
end
|
|
86
53
|
t38 = acc33
|
|
@@ -30,27 +30,24 @@
|
|
|
30
30
|
)
|
|
31
31
|
(Declaration big_team
|
|
32
32
|
%t21 = load_input "depts" :: array
|
|
33
|
-
%t28 = const 10 :: integer
|
|
34
33
|
loop depts id=L5 in %t21 as el=%depts_el_22, idx=%depts_i_23
|
|
35
34
|
%t24 = load_field depts_el_22["teams"] :: any
|
|
36
35
|
loop teams id=L6 in %t24 as el=%teams_el_25, idx=%teams_i_26
|
|
37
36
|
%t27 = load_field teams_el_25["headcount"] :: integer
|
|
38
|
-
%t29 = call core.gt(%t27,
|
|
37
|
+
%t29 = call core.gt(%t27, 10) :: boolean
|
|
39
38
|
yield %t29
|
|
40
39
|
end_loop
|
|
41
40
|
end_loop
|
|
42
41
|
)
|
|
43
42
|
(Declaration dept_total_masked
|
|
44
43
|
%t30 = load_input "depts" :: array
|
|
45
|
-
%t45 = const 10 :: integer
|
|
46
|
-
%t39 = const 0 :: integer
|
|
47
44
|
loop depts id=L7 in %t30 as el=%depts_el_31, idx=%depts_i_32
|
|
48
45
|
%acc_33 = decl_acc :: integer
|
|
49
46
|
%t34 = load_field depts_el_31["teams"] :: any
|
|
50
47
|
loop teams id=L8 in %t34 as el=%teams_el_35, idx=%teams_i_36
|
|
51
48
|
%t44 = load_field teams_el_35["headcount"] :: integer
|
|
52
|
-
%t46 = call core.gt(%t44,
|
|
53
|
-
%t40 = select %t46, %t44,
|
|
49
|
+
%t46 = call core.gt(%t44, 10) :: boolean
|
|
50
|
+
%t40 = select %t46, %t44, 0 :: integer
|
|
54
51
|
%acc_33 = acc_add agg.sum(%acc_33, %t40) :: integer
|
|
55
52
|
end_loop
|
|
56
53
|
%t41 = acc_load %acc_33 :: integer
|
|
@@ -31,13 +31,12 @@ export function _company_total(input) {
|
|
|
31
31
|
export function _big_team(input) {
|
|
32
32
|
let out = [];
|
|
33
33
|
let t21 = input["depts"];
|
|
34
|
-
const t28 = 10;
|
|
35
34
|
t21.forEach((depts_el_22, depts_i_23) => {
|
|
36
35
|
let out_1 = [];
|
|
37
36
|
let t24 = depts_el_22["teams"];
|
|
38
37
|
t24.forEach((teams_el_25, teams_i_26) => {
|
|
39
38
|
let t27 = teams_el_25["headcount"];
|
|
40
|
-
let t29 = t27 >
|
|
39
|
+
let t29 = t27 > 10;
|
|
41
40
|
out_1.push(t29);
|
|
42
41
|
});
|
|
43
42
|
out.push(out_1);
|
|
@@ -48,15 +47,13 @@ export function _big_team(input) {
|
|
|
48
47
|
export function _dept_total_masked(input) {
|
|
49
48
|
let out = [];
|
|
50
49
|
let t30 = input["depts"];
|
|
51
|
-
const t45 = 10;
|
|
52
|
-
const t39 = 0;
|
|
53
50
|
t30.forEach((depts_el_31, depts_i_32) => {
|
|
54
51
|
let acc_33 = 0;
|
|
55
52
|
let t34 = depts_el_31["teams"];
|
|
56
53
|
t34.forEach((teams_el_35, teams_i_36) => {
|
|
57
54
|
let t44 = teams_el_35["headcount"];
|
|
58
|
-
let t46 = t44 >
|
|
59
|
-
let t40 = t46 ? t44 :
|
|
55
|
+
let t46 = t44 > 10;
|
|
56
|
+
let t40 = t46 ? t44 : 0;
|
|
60
57
|
acc_33 += t40;
|
|
61
58
|
});
|
|
62
59
|
out.push(acc_33);
|
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :dept_total then _dept_total
|
|
24
|
-
when :company_total then _company_total
|
|
25
|
-
when :big_team then _big_team
|
|
26
|
-
when :dept_total_masked then _dept_total_masked
|
|
27
|
-
else raise KeyError, "Unknown declaration"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def _dept_total(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_bacb0d45a9d39539bfc969c28b88f0a518a0cafc18a74bf59058709a9c6880c2
|
|
3
|
+
def self._dept_total(input)
|
|
32
4
|
out = []
|
|
33
5
|
t1 = input["depts"] || input[:depts]
|
|
34
6
|
t1.each_with_index do |depts_el_2, depts_i_3|
|
|
@@ -44,7 +16,7 @@ module Kumi::Compiled::KUMI_cf23e8e7c8d8426eee61228bb8e1cf1452d26d65d0c304f0341a
|
|
|
44
16
|
out
|
|
45
17
|
end
|
|
46
18
|
|
|
47
|
-
def _company_total(input
|
|
19
|
+
def self._company_total(input)
|
|
48
20
|
acc_10 = 0
|
|
49
21
|
t11 = input["depts"] || input[:depts]
|
|
50
22
|
t11.each_with_index do |depts_el_12, depts_i_13|
|
|
@@ -60,16 +32,15 @@ module Kumi::Compiled::KUMI_cf23e8e7c8d8426eee61228bb8e1cf1452d26d65d0c304f0341a
|
|
|
60
32
|
acc_10
|
|
61
33
|
end
|
|
62
34
|
|
|
63
|
-
def _big_team(input
|
|
35
|
+
def self._big_team(input)
|
|
64
36
|
out = []
|
|
65
37
|
t21 = input["depts"] || input[:depts]
|
|
66
|
-
t28 = 10
|
|
67
38
|
t21.each_with_index do |depts_el_22, depts_i_23|
|
|
68
39
|
out_1 = []
|
|
69
40
|
t24 = depts_el_22["teams"] || depts_el_22[:teams]
|
|
70
41
|
t24.each_with_index do |teams_el_25, teams_i_26|
|
|
71
42
|
t27 = teams_el_25["headcount"] || teams_el_25[:headcount]
|
|
72
|
-
t29 = t27 >
|
|
43
|
+
t29 = t27 > 10
|
|
73
44
|
out_1 << t29
|
|
74
45
|
end
|
|
75
46
|
out << out_1
|
|
@@ -77,18 +48,16 @@ module Kumi::Compiled::KUMI_cf23e8e7c8d8426eee61228bb8e1cf1452d26d65d0c304f0341a
|
|
|
77
48
|
out
|
|
78
49
|
end
|
|
79
50
|
|
|
80
|
-
def _dept_total_masked(input
|
|
51
|
+
def self._dept_total_masked(input)
|
|
81
52
|
out = []
|
|
82
53
|
t30 = input["depts"] || input[:depts]
|
|
83
|
-
t45 = 10
|
|
84
|
-
t39 = 0
|
|
85
54
|
t30.each_with_index do |depts_el_31, depts_i_32|
|
|
86
55
|
acc_33 = 0
|
|
87
56
|
t34 = depts_el_31["teams"] || depts_el_31[:teams]
|
|
88
57
|
t34.each_with_index do |teams_el_35, teams_i_36|
|
|
89
58
|
t44 = teams_el_35["headcount"] || teams_el_35[:headcount]
|
|
90
|
-
t46 = t44 >
|
|
91
|
-
t40 = t46 ? t44 :
|
|
59
|
+
t46 = t44 > 10
|
|
60
|
+
t40 = t46 ? t44 : 0
|
|
92
61
|
acc_33 += t40
|
|
93
62
|
end
|
|
94
63
|
t41 = acc_33
|
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :sum_numbers then _sum_numbers
|
|
24
|
-
when :matrix_sums then _matrix_sums
|
|
25
|
-
when :mixed_array then _mixed_array
|
|
26
|
-
when :constant then _constant
|
|
27
|
-
else raise KeyError, "Unknown declaration"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def _sum_numbers(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_4787e2ae9af7d42a614ff55eb15adf135a939d4f74ff00d37a8a78b759415b95
|
|
3
|
+
def self._sum_numbers(input)
|
|
32
4
|
acc_1 = 0
|
|
33
5
|
t2 = input["numbers"] || input[:numbers]
|
|
34
6
|
t2.each_with_index do |numbers_el_3, numbers_i_4|
|
|
@@ -38,7 +10,7 @@ module Kumi::Compiled::KUMI_cdffe121fdc762472c12af1078546c29f5339df58b3d1ed602ab
|
|
|
38
10
|
acc_1
|
|
39
11
|
end
|
|
40
12
|
|
|
41
|
-
def _matrix_sums(input
|
|
13
|
+
def self._matrix_sums(input)
|
|
42
14
|
out = []
|
|
43
15
|
t7 = input["matrix"] || input[:matrix]
|
|
44
16
|
t7.each_with_index do |matrix_el_8, matrix_i_9|
|
|
@@ -54,7 +26,7 @@ module Kumi::Compiled::KUMI_cdffe121fdc762472c12af1078546c29f5339df58b3d1ed602ab
|
|
|
54
26
|
out
|
|
55
27
|
end
|
|
56
28
|
|
|
57
|
-
def _mixed_array(input
|
|
29
|
+
def self._mixed_array(input)
|
|
58
30
|
out = []
|
|
59
31
|
t16 = input["matrix"] || input[:matrix]
|
|
60
32
|
acc28 = 0
|
|
@@ -78,7 +50,7 @@ module Kumi::Compiled::KUMI_cdffe121fdc762472c12af1078546c29f5339df58b3d1ed602ab
|
|
|
78
50
|
out
|
|
79
51
|
end
|
|
80
52
|
|
|
81
|
-
def _constant(input
|
|
53
|
+
def self._constant(input)
|
|
82
54
|
42
|
|
83
55
|
end
|
|
84
56
|
end
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
(LIR
|
|
2
2
|
(Declaration global_offset_plus
|
|
3
3
|
%t1 = load_input "global_offset" :: float
|
|
4
|
-
%
|
|
5
|
-
%t3 = call core.add(%t1, %t2) :: float
|
|
4
|
+
%t3 = call core.add(%t1, 1.0) :: float
|
|
6
5
|
yield %t3
|
|
7
6
|
)
|
|
8
7
|
(Declaration batch_bias
|
|
9
8
|
%t4 = load_input "batch" :: array
|
|
10
9
|
%t54 = load_input "global_offset" :: float
|
|
11
|
-
%
|
|
12
|
-
%t56 = call core.add(%t54, %t55) :: float
|
|
10
|
+
%t56 = call core.add(%t54, 1.0) :: float
|
|
13
11
|
loop batch id=L1 in %t4 as el=%batch_el_5, idx=%batch_i_6
|
|
14
12
|
%t7 = load_field batch_el_5["mean"] :: float
|
|
15
13
|
%t9 = call core.add(%t7, %t56) :: float
|
|
@@ -18,29 +16,26 @@
|
|
|
18
16
|
)
|
|
19
17
|
(Declaration row_scale2
|
|
20
18
|
%t10 = load_input "batch" :: array
|
|
21
|
-
%t17 = const 2.0 :: float
|
|
22
19
|
loop batch id=L2 in %t10 as el=%batch_el_11, idx=%batch_i_12
|
|
23
20
|
%t13 = load_field batch_el_11["row"] :: any
|
|
24
21
|
loop row id=L3 in %t13 as el=%row_el_14, idx=%row_i_15
|
|
25
22
|
%t16 = load_field row_el_14["scale"] :: float
|
|
26
|
-
%t18 = call core.mul:numeric(%t16,
|
|
23
|
+
%t18 = call core.mul:numeric(%t16, 2.0) :: float
|
|
27
24
|
yield %t18
|
|
28
25
|
end_loop
|
|
29
26
|
end_loop
|
|
30
27
|
)
|
|
31
28
|
(Declaration elem_affine
|
|
32
29
|
%t66 = load_input "global_offset" :: float
|
|
33
|
-
%
|
|
34
|
-
%t68 = call core.add(%t66, %t67) :: float
|
|
30
|
+
%t68 = call core.add(%t66, 1.0) :: float
|
|
35
31
|
%t19 = load_input "batch" :: array
|
|
36
|
-
%t60 = const 2.0 :: float
|
|
37
32
|
loop batch id=L4 in %t19 as el=%batch_el_20, idx=%batch_i_21
|
|
38
33
|
%t64 = load_field batch_el_20["mean"] :: float
|
|
39
34
|
%t22 = load_field batch_el_20["row"] :: any
|
|
40
35
|
%t65 = call core.add(%t64, %t68) :: float
|
|
41
36
|
loop row id=L5 in %t22 as el=%row_el_23, idx=%row_i_24
|
|
42
37
|
%t59 = load_field row_el_23["scale"] :: float
|
|
43
|
-
%t61 = call core.mul:numeric(%t59,
|
|
38
|
+
%t61 = call core.mul:numeric(%t59, 2.0) :: float
|
|
44
39
|
%t25 = load_field row_el_23["col"] :: any
|
|
45
40
|
loop col id=L6 in %t25 as el=%col_el_26, idx=%col_i_27
|
|
46
41
|
%t28 = load_field col_el_26["val"] :: float
|
|
@@ -53,17 +48,15 @@
|
|
|
53
48
|
)
|
|
54
49
|
(Declaration row_sum_affine
|
|
55
50
|
%t86 = load_input "global_offset" :: float
|
|
56
|
-
%
|
|
57
|
-
%t88 = call core.add(%t86, %t87) :: float
|
|
51
|
+
%t88 = call core.add(%t86, 1.0) :: float
|
|
58
52
|
%t33 = load_input "batch" :: array
|
|
59
|
-
%t80 = const 2.0 :: float
|
|
60
53
|
loop batch id=L7 in %t33 as el=%batch_el_34, idx=%batch_i_35
|
|
61
54
|
%t84 = load_field batch_el_34["mean"] :: float
|
|
62
55
|
%t36 = load_field batch_el_34["row"] :: any
|
|
63
56
|
%t85 = call core.add(%t84, %t88) :: float
|
|
64
57
|
loop row id=L8 in %t36 as el=%row_el_37, idx=%row_i_38
|
|
65
58
|
%t79 = load_field row_el_37["scale"] :: float
|
|
66
|
-
%t81 = call core.mul:numeric(%t79,
|
|
59
|
+
%t81 = call core.mul:numeric(%t79, 2.0) :: float
|
|
67
60
|
%acc_39 = decl_acc :: float
|
|
68
61
|
%t40 = load_field row_el_37["col"] :: any
|
|
69
62
|
loop col id=L9 in %t40 as el=%col_el_41, idx=%col_i_42
|
|
@@ -79,10 +72,8 @@
|
|
|
79
72
|
)
|
|
80
73
|
(Declaration batch_total_affine
|
|
81
74
|
%t115 = load_input "global_offset" :: float
|
|
82
|
-
%
|
|
83
|
-
%t117 = call core.add(%t115, %t116) :: float
|
|
75
|
+
%t117 = call core.add(%t115, 1.0) :: float
|
|
84
76
|
%t45 = load_input "batch" :: array
|
|
85
|
-
%t109 = const 2.0 :: float
|
|
86
77
|
loop batch id=L10 in %t45 as el=%batch_el_46, idx=%batch_i_47
|
|
87
78
|
%t113 = load_field batch_el_46["mean"] :: float
|
|
88
79
|
%acc_48 = decl_acc :: float
|
|
@@ -90,7 +81,7 @@
|
|
|
90
81
|
%t114 = call core.add(%t113, %t117) :: float
|
|
91
82
|
loop row id=L11 in %t49 as el=%row_el_50, idx=%row_i_51
|
|
92
83
|
%t108 = load_field row_el_50["scale"] :: float
|
|
93
|
-
%t110 = call core.mul:numeric(%t108,
|
|
84
|
+
%t110 = call core.mul:numeric(%t108, 2.0) :: float
|
|
94
85
|
%acc92 = decl_acc :: float
|
|
95
86
|
%t93 = load_field row_el_50["col"] :: any
|
|
96
87
|
loop col id=L12 in %t93 as el=%t94, idx=%t95
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export function _global_offset_plus(input) {
|
|
2
2
|
let t1 = input["global_offset"];
|
|
3
|
-
|
|
4
|
-
let t3 = t1 + t2;
|
|
3
|
+
let t3 = t1 + 1.0;
|
|
5
4
|
return t3;
|
|
6
5
|
}
|
|
7
6
|
|
|
@@ -9,8 +8,7 @@ export function _batch_bias(input) {
|
|
|
9
8
|
let out = [];
|
|
10
9
|
let t4 = input["batch"];
|
|
11
10
|
let t54 = input["global_offset"];
|
|
12
|
-
|
|
13
|
-
let t56 = t54 + t55;
|
|
11
|
+
let t56 = t54 + 1.0;
|
|
14
12
|
t4.forEach((batch_el_5, batch_i_6) => {
|
|
15
13
|
let t7 = batch_el_5["mean"];
|
|
16
14
|
let t9 = t7 + t56;
|
|
@@ -22,13 +20,12 @@ export function _batch_bias(input) {
|
|
|
22
20
|
export function _row_scale2(input) {
|
|
23
21
|
let out = [];
|
|
24
22
|
let t10 = input["batch"];
|
|
25
|
-
const t17 = 2.0;
|
|
26
23
|
t10.forEach((batch_el_11, batch_i_12) => {
|
|
27
24
|
let out_1 = [];
|
|
28
25
|
let t13 = batch_el_11["row"];
|
|
29
26
|
t13.forEach((row_el_14, row_i_15) => {
|
|
30
27
|
let t16 = row_el_14["scale"];
|
|
31
|
-
let t18 = t16 *
|
|
28
|
+
let t18 = t16 * 2.0;
|
|
32
29
|
out_1.push(t18);
|
|
33
30
|
});
|
|
34
31
|
out.push(out_1);
|
|
@@ -39,10 +36,8 @@ export function _row_scale2(input) {
|
|
|
39
36
|
export function _elem_affine(input) {
|
|
40
37
|
let out = [];
|
|
41
38
|
let t66 = input["global_offset"];
|
|
42
|
-
|
|
43
|
-
let t68 = t66 + t67;
|
|
39
|
+
let t68 = t66 + 1.0;
|
|
44
40
|
let t19 = input["batch"];
|
|
45
|
-
const t60 = 2.0;
|
|
46
41
|
t19.forEach((batch_el_20, batch_i_21) => {
|
|
47
42
|
let out_1 = [];
|
|
48
43
|
let t64 = batch_el_20["mean"];
|
|
@@ -51,7 +46,7 @@ export function _elem_affine(input) {
|
|
|
51
46
|
t22.forEach((row_el_23, row_i_24) => {
|
|
52
47
|
let out_2 = [];
|
|
53
48
|
let t59 = row_el_23["scale"];
|
|
54
|
-
let t61 = t59 *
|
|
49
|
+
let t61 = t59 * 2.0;
|
|
55
50
|
let t25 = row_el_23["col"];
|
|
56
51
|
t25.forEach((col_el_26, col_i_27) => {
|
|
57
52
|
let t28 = col_el_26["val"];
|
|
@@ -69,10 +64,8 @@ export function _elem_affine(input) {
|
|
|
69
64
|
export function _row_sum_affine(input) {
|
|
70
65
|
let out = [];
|
|
71
66
|
let t86 = input["global_offset"];
|
|
72
|
-
|
|
73
|
-
let t88 = t86 + t87;
|
|
67
|
+
let t88 = t86 + 1.0;
|
|
74
68
|
let t33 = input["batch"];
|
|
75
|
-
const t80 = 2.0;
|
|
76
69
|
t33.forEach((batch_el_34, batch_i_35) => {
|
|
77
70
|
let out_1 = [];
|
|
78
71
|
let t84 = batch_el_34["mean"];
|
|
@@ -80,7 +73,7 @@ export function _row_sum_affine(input) {
|
|
|
80
73
|
let t85 = t84 + t88;
|
|
81
74
|
t36.forEach((row_el_37, row_i_38) => {
|
|
82
75
|
let t79 = row_el_37["scale"];
|
|
83
|
-
let t81 = t79 *
|
|
76
|
+
let t81 = t79 * 2.0;
|
|
84
77
|
let acc_39 = 0.0;
|
|
85
78
|
let t40 = row_el_37["col"];
|
|
86
79
|
t40.forEach((col_el_41, col_i_42) => {
|
|
@@ -99,10 +92,8 @@ export function _row_sum_affine(input) {
|
|
|
99
92
|
export function _batch_total_affine(input) {
|
|
100
93
|
let out = [];
|
|
101
94
|
let t115 = input["global_offset"];
|
|
102
|
-
|
|
103
|
-
let t117 = t115 + t116;
|
|
95
|
+
let t117 = t115 + 1.0;
|
|
104
96
|
let t45 = input["batch"];
|
|
105
|
-
const t109 = 2.0;
|
|
106
97
|
t45.forEach((batch_el_46, batch_i_47) => {
|
|
107
98
|
let t113 = batch_el_46["mean"];
|
|
108
99
|
let acc_48 = 0.0;
|
|
@@ -110,7 +101,7 @@ export function _batch_total_affine(input) {
|
|
|
110
101
|
let t114 = t113 + t117;
|
|
111
102
|
t49.forEach((row_el_50, row_i_51) => {
|
|
112
103
|
let t108 = row_el_50["scale"];
|
|
113
|
-
let t110 = t108 *
|
|
104
|
+
let t110 = t108 * 2.0;
|
|
114
105
|
let acc92 = 0.0;
|
|
115
106
|
let t93 = row_el_50["col"];
|
|
116
107
|
t93.forEach((t94, t95) => {
|