neuralogic 0.8.2.dev0__tar.gz → 0.8.3.dev0__tar.gz

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.
Files changed (158) hide show
  1. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/PKG-INFO +1 -1
  2. neuralogic-0.8.3.dev0/neuralogic/__version__.py +1 -0
  3. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/builder/components.py +14 -9
  4. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/java_objects.py +3 -2
  5. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/neural_module.py +2 -0
  6. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/settings/settings_proxy.py +2 -2
  7. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/torch/tensor.py +1 -1
  8. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/jar/NeuraLogic.jar +0 -0
  9. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic.egg-info/PKG-INFO +1 -1
  10. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/pyproject.toml +1 -1
  11. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_function.py +4 -5
  12. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_general_modules.py +2 -1
  13. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_inference_engine.py +2 -2
  14. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_java_evaluation.py +4 -44
  15. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_quick_start.py +2 -2
  16. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_recurrent_modules.py +7 -7
  17. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_special_predicates.py +9 -19
  18. neuralogic-0.8.2.dev0/neuralogic/__version__.py +0 -1
  19. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/LICENSE +0 -0
  20. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/README.md +0 -0
  21. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/__init__.py +0 -0
  22. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/__init__.py +0 -0
  23. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/builder/__init__.py +0 -0
  24. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/builder/builder.py +0 -0
  25. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/builder/dataset.py +0 -0
  26. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/builder/dataset_builder.py +0 -0
  27. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/__init__.py +0 -0
  28. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/factories.py +0 -0
  29. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/__init__.py +0 -0
  30. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/concat.py +0 -0
  31. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/enum.py +0 -0
  32. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/function.py +0 -0
  33. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/function_container.py +0 -0
  34. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/function_graph.py +0 -0
  35. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/reshape.py +0 -0
  36. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/slice.py +0 -0
  37. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/function/softmax.py +0 -0
  38. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/metadata.py +0 -0
  39. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/predicate.py +0 -0
  40. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/relation.py +0 -0
  41. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/rule.py +0 -0
  42. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/constructs/term.py +0 -0
  43. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/enums.py +0 -0
  44. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/settings/__init__.py +0 -0
  45. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/sources.py +0 -0
  46. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/template.py +0 -0
  47. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/torch/__init__.py +0 -0
  48. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/torch/network_output.py +0 -0
  49. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/core/torch/neural_module.py +0 -0
  50. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/__init__.py +0 -0
  51. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/base.py +0 -0
  52. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/csv.py +0 -0
  53. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/db.py +0 -0
  54. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/file.py +0 -0
  55. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/logic.py +0 -0
  56. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/dataset/tensor.py +0 -0
  57. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/experimental/__init__.py +0 -0
  58. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/experimental/db/__init__.py +0 -0
  59. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/experimental/db/converter.py +0 -0
  60. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/experimental/db/pg/__init__.py +0 -0
  61. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/experimental/db/pg/helpers.py +0 -0
  62. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/jar/__init__.py +0 -0
  63. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/logging/__init__.py +0 -0
  64. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/__init__.py +0 -0
  65. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/init.py +0 -0
  66. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/java.py +0 -0
  67. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/loss.py +0 -0
  68. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/__init__.py +0 -0
  69. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/__init__.py +0 -0
  70. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/attention.py +0 -0
  71. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/gru.py +0 -0
  72. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/linear.py +0 -0
  73. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/lstm.py +0 -0
  74. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/mlp.py +0 -0
  75. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/pooling.py +0 -0
  76. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/positional_encoding.py +0 -0
  77. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/rnn.py +0 -0
  78. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/rvnn.py +0 -0
  79. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/general/transformer.py +0 -0
  80. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/__init__.py +0 -0
  81. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/appnp.py +0 -0
  82. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gatv2.py +0 -0
  83. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gcn.py +0 -0
  84. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gen.py +0 -0
  85. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gin.py +0 -0
  86. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gine.py +0 -0
  87. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/gsage.py +0 -0
  88. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/res_gated.py +0 -0
  89. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/rgcn.py +0 -0
  90. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/sg.py +0 -0
  91. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/gnn/tag.py +0 -0
  92. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/meta/__init__.py +0 -0
  93. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/meta/magnn.py +0 -0
  94. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/meta/meta.py +0 -0
  95. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/module/module.py +0 -0
  96. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/torch_function.py +0 -0
  97. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/nn/trainer.py +0 -0
  98. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/__init__.py +0 -0
  99. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/adam.py +0 -0
  100. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/lr_scheduler/__init__.py +0 -0
  101. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/lr_scheduler/arithmetic.py +0 -0
  102. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/lr_scheduler/geometric.py +0 -0
  103. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/lr_scheduler/lr_decay.py +0 -0
  104. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/optimizer.py +0 -0
  105. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/optim/sgd.py +0 -0
  106. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/setup.py +0 -0
  107. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/__init__.py +0 -0
  108. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/__init__.py +0 -0
  109. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/atomEmbeddings3.txt +0 -0
  110. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/bondEmbeddings3.txt +0 -0
  111. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/examples.txt +0 -0
  112. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/queries.txt +0 -0
  113. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/embeddings.txt +0 -0
  114. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template.txt +0 -0
  115. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_crosssum.txt +0 -0
  116. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_elementProduct.txt +0 -0
  117. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_gnn.txt +0 -0
  118. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_graphlets.txt +0 -0
  119. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_partial.txt +0 -0
  120. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/molecules/mutagenesis/templates/template_product.txt +0 -0
  121. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/nations/embeddings.txt +0 -0
  122. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/nations/examples.txt +0 -0
  123. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/nations/queries.txt +0 -0
  124. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/nations/template.txt +0 -0
  125. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/family/examples.txt +0 -0
  126. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/family/queries.txt +0 -0
  127. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/family/template.txt +0 -0
  128. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/trains/examples.txt +0 -0
  129. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/trains/queries.txt +0 -0
  130. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/trains/template.txt +0 -0
  131. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/generalized/examples.txt +0 -0
  132. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/generalized/template.txt +0 -0
  133. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/generalized/texamples.txt +0 -0
  134. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/generalized/ztexamples.txt +0 -0
  135. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/naive/template.txt +0 -0
  136. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/naive/trainExamples.txt +0 -0
  137. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/solution/template.txt +0 -0
  138. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/solution/testExamples.txt +0 -0
  139. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/vectorized/template.txt +0 -0
  140. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/data/datasets/simple/xor/vectorized/trainExamples.txt +0 -0
  141. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic/utils/visualize/__init__.py +0 -0
  142. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic.egg-info/SOURCES.txt +0 -0
  143. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic.egg-info/dependency_links.txt +0 -0
  144. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic.egg-info/requires.txt +0 -0
  145. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/neuralogic.egg-info/top_level.txt +0 -0
  146. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/setup.cfg +0 -0
  147. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/setup.py +0 -0
  148. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_constructs.py +0 -0
  149. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_csv_datasets.py +0 -0
  150. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_datasets.py +0 -0
  151. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_drawing.py +0 -0
  152. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_gnn_modules.py +0 -0
  153. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_lr_decay.py +0 -0
  154. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_modules.py +0 -0
  155. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_settings.py +0 -0
  156. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_torch_function.py +0 -0
  157. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_transformer.py +0 -0
  158. {neuralogic-0.8.2.dev0 → neuralogic-0.8.3.dev0}/tests/test_xor_generalization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuralogic
3
- Version: 0.8.2.dev0
3
+ Version: 0.8.3.dev0
4
4
  Summary: PyNeuraLogic lets you use Python to create Differentiable Logic Programs.
5
5
  Home-page: https://github.com/LukasZahradnik/PyNeuraLogic
6
6
  Author: Lukáš Zahradník
@@ -0,0 +1 @@
1
+ __version__ = "0.8.3.dev"
@@ -34,14 +34,6 @@ class Atom:
34
34
  def arity(self):
35
35
  return self._arity
36
36
 
37
- @property
38
- def value(self):
39
- return ValueFactory.from_java(self._atom.getRawState().getValue())
40
-
41
- @property
42
- def gradient(self):
43
- return ValueFactory.from_java(self._atom.getRawState().getGradient())
44
-
45
37
  def node_type(self) -> NeuronType:
46
38
  return NeuronType(self._atom.getClass().getSimpleName())
47
39
 
@@ -50,7 +42,20 @@ class Atom:
50
42
 
51
43
 
52
44
  class Neuron(Atom):
53
- pass
45
+ def __init__(self, neuron, substitutions: Dict):
46
+ self.substitutions = substitutions
47
+ self._atom = neuron
48
+
49
+ self._predicate = neuron.getName()
50
+ self._arity = len(substitutions)
51
+
52
+ @property
53
+ def value(self):
54
+ return ValueFactory.from_java(self._atom.getRawState().getValue())
55
+
56
+ @property
57
+ def gradient(self):
58
+ return ValueFactory.from_java(self._atom.getRawState().getGradient())
54
59
 
55
60
 
56
61
  class NeuralSample:
@@ -23,10 +23,11 @@ class ValueFactory:
23
23
  @staticmethod
24
24
  def from_java(value):
25
25
  size = list(value.size())
26
-
27
26
  if len(size) == 0 or size[0] == 0:
28
27
  return float(value.get(0))
29
- return np.array(memoryview(value.getAsArray())).reshape(size).tolist()
28
+ if len(size) == 2 and size[1] != 1:
29
+ return np.array(memoryview(value.getAsArray())).reshape(size).tolist()
30
+ return np.array(memoryview(value.getAsArray())).tolist()
30
31
 
31
32
  def get_value(self, weight):
32
33
  if isinstance(weight, (float, int)) or np.ndim(weight) == 0:
@@ -188,6 +188,8 @@ class NeuralModule:
188
188
  *args,
189
189
  **kwargs,
190
190
  ):
191
+ if self._dataset_builder is None or self._settings is None:
192
+ raise ValueError("template is not built")
191
193
  return draw_model(self, filename, show, img_type, value_detail, graphviz_path, *args, **kwargs)
192
194
 
193
195
  def _initialize_neural_module(self, dataset_builder: DatasetBuilder, settings: SettingsProxy, model, torch: bool):
@@ -140,7 +140,7 @@ class SettingsProxy:
140
140
 
141
141
  @error_function.setter
142
142
  def error_function(self, error_function: ErrorFunction):
143
- self.settings.inferOutputFcns = True
143
+ self.settings.inferOutputFcns = False
144
144
 
145
145
  if isinstance(error_function, MSE):
146
146
  self.settings.squishLastLayer = False
@@ -157,7 +157,7 @@ class SettingsProxy:
157
157
  self.settings.squishLastLayer = True
158
158
  java_error_function = self.settings_class.ErrorFcn.SOFTENTROPY
159
159
  else:
160
- self.settings.inferOutputFcns = False
160
+ self.settings.inferOutputFcns = True
161
161
  self.settings.squishLastLayer = False
162
162
  java_error_function = self.settings_class.ErrorFcn.CROSSENTROPY
163
163
  else:
@@ -45,7 +45,7 @@ class NeuralogicOptTensor(torch.Tensor):
45
45
  if value is None:
46
46
  return None
47
47
 
48
- p = -torch.tensor(self._neuralogic_value_factory.from_java(value, self._neuralogic_number_format))
48
+ p = -torch.tensor(self._neuralogic_value_factory.from_java(value))
49
49
  return p
50
50
 
51
51
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuralogic
3
- Version: 0.8.2.dev0
3
+ Version: 0.8.3.dev0
4
4
  Summary: PyNeuraLogic lets you use Python to create Differentiable Logic Programs.
5
5
  Home-page: https://github.com/LukasZahradnik/PyNeuraLogic
6
6
  Author: Lukáš Zahradník
@@ -1,6 +1,6 @@
1
1
  [tool.black]
2
2
  line-length = 120
3
- target-version = ['py39']
3
+ target-version = ['py313']
4
4
 
5
5
  [tool.mypy]
6
6
  ignore_missing_imports = true
@@ -31,8 +31,7 @@ def test_transformation_body_function(torch_fun, fun):
31
31
  dataset = Dataset([Sample(R.h, R.input[data.tolist()])])
32
32
 
33
33
  built_dataset = model.build_dataset(dataset)
34
-
35
- results = np.array(model.test(built_dataset)[0]).round(3)
34
+ results = np.array(model.test(built_dataset)).round(3)
36
35
 
37
36
  assert np.allclose(torch_result, results, atol=0.0001)
38
37
 
@@ -61,7 +60,7 @@ def test_slice_function():
61
60
  dataset = Dataset([Sample(R.h, [R.input[data]])])
62
61
 
63
62
  built_dataset = model.build_dataset(dataset)
64
- results = np.array(model.test(built_dataset)[0])
63
+ results = np.array(model.test(built_dataset))
65
64
 
66
65
  assert np.allclose(res, results)
67
66
 
@@ -72,7 +71,7 @@ def test_slice_function():
72
71
  dataset = Dataset(Sample(R.h, [R.input[data]]))
73
72
 
74
73
  built_dataset = model.build_dataset(dataset)
75
- results = np.array(model.test(built_dataset)[0])
74
+ results = np.array(model.test(built_dataset))
76
75
 
77
76
  assert np.allclose(res, results)
78
77
 
@@ -84,6 +83,6 @@ def test_slice_function():
84
83
  dataset = Dataset(Sample(R.h, [R.input[data]]))
85
84
 
86
85
  built_dataset = model.build_dataset(dataset)
87
- results = np.array(model.test(built_dataset)[0])
86
+ results = np.array(model.test(built_dataset))
88
87
 
89
88
  assert np.allclose(res, results)
@@ -3,6 +3,7 @@ import pytest
3
3
  import torch
4
4
 
5
5
  from neuralogic.core import Template, R, Settings, Transformation
6
+ from neuralogic.core.constructs.function.function import TransformationFunction
6
7
  from neuralogic.nn.module import Linear
7
8
  from neuralogic.dataset import Dataset, Sample
8
9
 
@@ -16,7 +17,7 @@ from neuralogic.dataset import Dataset, Sample
16
17
  (3, 3, 1, Transformation.TANH),
17
18
  ),
18
19
  )
19
- def test_linear_module(feature_size: int, output_size: int, num_of_inputs: int, activation: Transformation):
20
+ def test_linear_module(feature_size: int, output_size: int, num_of_inputs: int, activation: TransformationFunction):
20
21
  """Test that PyNeuraLogic linear layer computes the same as pytorch linear layer"""
21
22
  torch.manual_seed(1)
22
23
  linear_input = torch.rand((num_of_inputs, feature_size))
@@ -108,7 +108,7 @@ def test_listing_all_queries() -> None:
108
108
  template += R.edge(2, 3)
109
109
  template += R.edge(3, 1)
110
110
 
111
- queries = list(template.queries())
111
+ queries = list(template.derivable_queries())
112
112
 
113
113
  expected_queries = sorted(
114
114
  ["edge(1, 2).", "edge(2, 3).", "edge(3, 1).", "h(2).", "h(3).", "h(1).", "h1(1).", "h1(2).", "h1(3).", "q."]
@@ -118,7 +118,7 @@ def test_listing_all_queries() -> None:
118
118
  for a, b in zip(expected_queries, str_queries):
119
119
  assert a == b
120
120
 
121
- queries = list(template.queries([R.edge(1, 4)]))
121
+ queries = list(template.derivable_queries([R.edge(1, 4)]))
122
122
 
123
123
  expected_queries = sorted(
124
124
  [
@@ -26,28 +26,8 @@ import pytest
26
26
  (*XOR_Vectorized(), [0, 0.7, 0.657, -0.056]),
27
27
  (
28
28
  *Trains(),
29
- [
30
- 0.693,
31
- -0.751,
32
- 0.744,
33
- 0.733,
34
- 0.714,
35
- 0.75,
36
- 0.736,
37
- -0.726,
38
- 0.754,
39
- 0.758,
40
- 0.403,
41
- -0.752,
42
- -0.624,
43
- -0.742,
44
- -0.378,
45
- -0.758,
46
- -0.756,
47
- -0.758,
48
- -0.687,
49
- -0.383,
50
- ],
29
+ [0.755, 0.75, -0.761, 0.749, 0.76, 0.724, -0.753, 0.754, -0.748, -0.755, -0.757, -0.761, 0.73, 0.742,
30
+ -0.752, -0.691, 0.748, 0.758, -0.73, -0.75]
51
31
  ),
52
32
  (
53
33
  *Mutagenesis(),
@@ -273,28 +253,8 @@ def test_evaluator_run_on_files(template: Template, dataset: BaseDataset, expect
273
253
  (
274
254
  naive_trains.template,
275
255
  naive_trains.dataset,
276
- [
277
- 0.743,
278
- 0.745,
279
- 0.735,
280
- -0.761,
281
- -0.74,
282
- -0.761,
283
- 0.739,
284
- 0.761,
285
- -0.761,
286
- -0.761,
287
- -0.761,
288
- -0.761,
289
- -0.761,
290
- -0.761,
291
- -0.746,
292
- -0.761,
293
- -0.761,
294
- -0.749,
295
- -0.734,
296
- 0.761,
297
- ],
256
+ [0.76, 0.761, -0.762, 0.761, 0.761, 0.758, -0.76, 0.761, -0.76, -0.761, -0.761, -0.761, 0.757, 0.757,
257
+ -0.761, -0.754, 0.759, 0.761, -0.757, -0.761],
298
258
  0,
299
259
  ),
300
260
  (
@@ -79,7 +79,7 @@ def test_model_evaluation_from_tensor():
79
79
  output = template.train(built_dataset, epochs=100)
80
80
 
81
81
  assert len(output[0]) == 3
82
- assert output[1] == 3
82
+ assert len(output[1]) == 3
83
83
 
84
84
 
85
85
  def test_model_evaluation_from_logic():
@@ -121,4 +121,4 @@ def test_model_evaluation_from_logic():
121
121
  output = template.train(built_dataset, epochs=100)
122
122
 
123
123
  assert len(output[0]) == 3
124
- assert output[1] == 3
124
+ assert len(output[1]) == 3
@@ -69,7 +69,7 @@ def test_gru_module(input_size, hidden_size, sequence_len, epochs):
69
69
  loss.backward()
70
70
  optimizer.step()
71
71
 
72
- result, _ = model.train(bd)
72
+ result = model.train(bd)
73
73
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
74
74
 
75
75
 
@@ -127,7 +127,7 @@ def test_rnn_module(input_size, hidden_size, sequence_len, epochs):
127
127
  loss.backward()
128
128
  optimizer.step()
129
129
 
130
- result, _ = model.train(bd)
130
+ result = model.train(bd)
131
131
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
132
132
 
133
133
 
@@ -194,7 +194,7 @@ def test_lstm_module(input_size, hidden_size, sequence_len, epochs):
194
194
  loss.backward()
195
195
  optimizer.step()
196
196
 
197
- result, _ = model.train(bd)
197
+ result = model.train(bd)
198
198
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
199
199
 
200
200
 
@@ -215,7 +215,7 @@ def test_rnn_module_with_pytorch(input_size, hidden_size, sequence_len, epochs):
215
215
  template = Template()
216
216
  template += RNN(input_size, hidden_size, "h", "f", "h0", arity=0)
217
217
 
218
- model = template.build(Settings(chain_pruning=False, iso_value_compression=False, error_function=MSE()))
218
+ model = template.build(Settings(chain_pruning=False, iso_value_compression=False, error_function=MSE()), torch=True)
219
219
 
220
220
  parameters = model.parameters()
221
221
  pyneuralogic_tensor_parameters = model.tensor_parameters()
@@ -322,7 +322,7 @@ def test_rnn_custom(input_size, hidden_size, sequence_len, epochs):
322
322
  loss.backward()
323
323
  optimizer.step()
324
324
 
325
- result, _ = model.train(bd, epochs=1)
325
+ result = model.train(bd, epochs=1)
326
326
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
327
327
 
328
328
 
@@ -417,7 +417,7 @@ def test_lstm_module_simple(input_size, hidden_size, sequence_len, epochs):
417
417
  loss.backward()
418
418
  optimizer.step()
419
419
 
420
- result, _ = model.train(bd, 1)
420
+ result = model.train(bd, 1)
421
421
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
422
422
 
423
423
 
@@ -496,5 +496,5 @@ def test_gru_module_simple(input_size, hidden_size, sequence_len, epochs):
496
496
  loss.backward()
497
497
  optimizer.step()
498
498
 
499
- result, _ = model.train(bd, 1)
499
+ result = model.train(bd, 1)
500
500
  assert np.allclose([float(x) for x in output[-1]], [float(x) for x in result[0][1]], atol=10e-5)
@@ -1,15 +1,13 @@
1
1
  from neuralogic.core import Template, V, R
2
- from neuralogic.inference import InferenceEngine
3
2
 
4
3
 
5
4
  def test_neq():
6
5
  template = Template()
7
6
  template += R.head(V.X, V.Y) <= (R.special.neq(V.X, V.Y), R.val(V.X), R.val(V.Y))
8
7
 
9
- inference_engine = InferenceEngine(template)
10
8
  examples = [R.val(1), R.val(-1)]
11
9
 
12
- out = inference_engine.q(R.head(V.X, V.Y), examples)
10
+ out = template.q(R.head(V.X, V.Y), examples)
13
11
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
14
12
 
15
13
  assert len(out) == 2
@@ -25,10 +23,9 @@ def test_leq():
25
23
  template = Template()
26
24
  template += R.head(V.X, V.Y) <= (R.special.leq(V.X, V.Y), R.val(V.X), R.val(V.Y))
27
25
 
28
- inference_engine = InferenceEngine(template)
29
26
  examples = [R.val(1), R.val(-1)]
30
27
 
31
- out = inference_engine.q(R.head(V.X, V.Y), examples)
28
+ out = template.q(R.head(V.X, V.Y), examples)
32
29
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
33
30
 
34
31
  assert len(out) == 3
@@ -47,10 +44,9 @@ def test_geq():
47
44
  template = Template()
48
45
  template += R.head(V.X, V.Y) <= (R.special.geq(V.X, V.Y), R.val(V.X), R.val(V.Y))
49
46
 
50
- inference_engine = InferenceEngine(template)
51
47
  examples = [R.val(1), R.val(-1)]
52
48
 
53
- out = inference_engine.q(R.head(V.X, V.Y), examples)
49
+ out = template.q(R.head(V.X, V.Y), examples)
54
50
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
55
51
 
56
52
  assert len(out) == 3
@@ -69,10 +65,9 @@ def test_lt():
69
65
  template = Template()
70
66
  template += R.head(V.X, V.Y) <= (R.special.lt(V.X, V.Y), R.val(V.X), R.val(V.Y))
71
67
 
72
- inference_engine = InferenceEngine(template)
73
68
  examples = [R.val(1), R.val(-1)]
74
69
 
75
- out = inference_engine.q(R.head(V.X, V.Y), examples)
70
+ out = template.q(R.head(V.X, V.Y), examples)
76
71
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
77
72
 
78
73
  assert len(out) == 1
@@ -85,10 +80,9 @@ def test_gt():
85
80
  template = Template()
86
81
  template += R.head(V.X, V.Y) <= (R.special.gt(V.X, V.Y), R.val(V.X), R.val(V.Y))
87
82
 
88
- inference_engine = InferenceEngine(template)
89
83
  examples = [R.val(1), R.val(-1)]
90
84
 
91
- out = inference_engine.q(R.head(V.X, V.Y), examples)
85
+ out = template.q(R.head(V.X, V.Y), examples)
92
86
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
93
87
 
94
88
  assert len(out) == 1
@@ -101,10 +95,9 @@ def test_eq():
101
95
  template = Template()
102
96
  template += R.head(V.X, V.Y) <= (R.special.eq(V.X, V.Y), R.val(V.X), R.val(V.Y))
103
97
 
104
- inference_engine = InferenceEngine(template)
105
98
  examples = [R.val(1), R.val(-1)]
106
99
 
107
- out = inference_engine.q(R.head(V.X, V.Y), examples)
100
+ out = template.q(R.head(V.X, V.Y), examples)
108
101
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
109
102
 
110
103
  assert len(out) == 2
@@ -120,10 +113,9 @@ def test_next():
120
113
  template = Template()
121
114
  template += R.head(V.X, V.Y) <= (R.special.next(V.X, V.Y), R.val(V.X), R.val(V.Y))
122
115
 
123
- inference_engine = InferenceEngine(template)
124
116
  examples = [R.val(1), R.val(-1), R.val(0)]
125
117
 
126
- out = inference_engine.q(R.head(V.X, V.Y), examples)
118
+ out = template.q(R.head(V.X, V.Y), examples)
127
119
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
128
120
 
129
121
  assert len(out) == 2
@@ -139,10 +131,9 @@ def test_next_skip():
139
131
  template = Template()
140
132
  template += R.head(V.X, V.Y) <= (R.special.next(V.X, V.Z), R.special.next(V.Z, V.Y), R.val(V.X), R.val(V.Y))
141
133
 
142
- inference_engine = InferenceEngine(template)
143
134
  examples = [R.val(1), R.val(-1), R.val(0)]
144
135
 
145
- out = inference_engine.q(R.head(V.X, V.Y), examples)
136
+ out = template.q(R.head(V.X, V.Y), examples)
146
137
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
147
138
 
148
139
  assert len(out) == 1
@@ -155,10 +146,9 @@ def test_alldiff():
155
146
  template = Template()
156
147
  template += R.head(V.X, V.Y, V.Z) <= (R.special.alldiff(V.X, V.Y, V.Z), R.val(V.X), R.val(V.Y), R.val(V.Z))
157
148
 
158
- inference_engine = InferenceEngine(template)
159
149
  examples = [R.val(1), R.val(-1), R.val(0)]
160
150
 
161
- out = inference_engine.q(R.head(V.X, V.Y, V.Z), examples)
151
+ out = template.q(R.head(V.X, V.Y, V.Z), examples)
162
152
  out = sorted(list(out), key=lambda a: a["X"] + a["Y"])
163
153
 
164
154
  assert len(out) == 6
@@ -1 +0,0 @@
1
- __version__ = "0.8.2.dev"
File without changes