-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PKG: Add package lnn #1719
PKG: Add package lnn #1719
Conversation
ASR Verification fails currently: (lp) lpython$ cat integration_tests/aaaa1.py
from tmp_pkg import A, hi
def main():
hi()
a: A
main()
(lp) lpython$ lpython integration_tests/aaaa1.py --show-asr --indent
(TranslationUnit
(SymbolTable
1
{
A:
(ExternalSymbol
1
A
5 A
tmp
[]
A
Public
),
hi:
(ExternalSymbol
1
hi
5 hi
tmp
[]
hi
Public
),
main:
(Function
(SymbolTable
8
{
a:
(Variable
8
a
[]
Local
()
()
Default
(Struct
5 A
[]
)
Source
Public
Required
.false.
)
})
main
(FunctionType
[]
()
Source
Implementation
()
.false.
.false.
.false.
.false.
.false.
[]
[]
.false.
)
[hi]
[]
[(SubroutineCall
1 hi
()
[]
()
)]
()
Public
.false.
.false.
),
tmp:
(Module
(SymbolTable
5
{
A:
(StructType
(SymbolTable
6
{
x:
(Variable
6
x
[]
Local
()
()
Default
(Integer 4 [])
Source
Public
Required
.false.
)
})
A
[]
[x]
Source
Public
.false.
.false.
()
()
),
hi:
(Function
(SymbolTable
7
{
})
hi
(FunctionType
[]
()
Source
Implementation
()
.false.
.false.
.false.
.false.
.false.
[]
[]
.false.
)
[]
[]
[(Print
()
[(StringConstant
"hi"
(Character 1 2 () [])
)]
()
()
)]
()
Public
.false.
.false.
)
})
tmp
[]
.false.
.false.
),
tmp_pkg:
(Module
(SymbolTable
3
{
A:
(ExternalSymbol
3
A
5 A
tmp
[]
A
Public
),
hi:
(ExternalSymbol
3
hi
5 hi
tmp
[]
hi
Public
)
})
tmp_pkg
[tmp]
.false.
.false.
)
})
[(SubroutineCall
1 main
()
[]
()
)]
)
ASR verify pass error: ASR verify: Struct::m_derived_type cannot point outside of its symbol table
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
File "/Users/ubaid/Desktop/OpenSource/lpython/src/bin/lpython.cpp", line 1684
return emit_asr(arg_file, lpython_pass_manager, runtime_library_dir,
File "/Users/ubaid/Desktop/OpenSource/lpython/src/bin/lpython.cpp", line 194
r = LCompilers::LPython::python_ast_to_asr(al, lm, *ast, diagnostics,
File "/Users/ubaid/Desktop/OpenSource/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 6704
throw LCompilersException("Verify failed");
LCompilersException: Verify failed |
This is currently a WIP (Work in progress), hence the CI tests might not pass. |
39eb163
to
f3c8a46
Compare
This could improve performance as null checking would be constant If it evaluates to true, there is no call to std::find()
Also define normalizing functions
Fixes error: ASR verify: Struct::m_derived_type cannot point outside of its symbol table
Also conditionally enable pixel on screen
f3c8a46
to
1feb3bb
Compare
I posted some issues that I came across while working on this PR - #1721, #1722, #1723, #1724, #1725. There is also another issue about importing The initial commits perform some refactoring in the |
This is ready. Please review and share feedback. |
new_args.push_back(al, new_arg); | ||
args_updated = true; | ||
use_original_arg = false; | ||
void check_and_update_args_for_pass_arr_by_data_passed_as_callback(const T& x) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for #1721?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a refactoring of code into a function. I named the function as check_and_update_args_for_pass_arr_by_data_passed_as_callback
based on the operation that I thought the code was performing. I think it improves the code readibility. I think it is not towards any specific issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just renamed it to update_args_for_pass_arr_by_data_funcs_passed_as_callback()
.
Awesome. Thanks @Shaikh-Ubaid for this, that's exactly what we need. To use LPython to create a library and see what bugs we hit and report them as you did. |
update_args_for_pass_arr_by_data_funcs_passed_as_callback()
This is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this is fine. @czgdp1807 do you see any issues with the code changes?
I am going to merge it, as it fixes an important bug (importing struct). Thank you @Shaikh-Ubaid, great work! |
Thank you for the approval and merging! |
towards #992
This PR adds a basic neural network package consisting of a single perceptron node. It can do binary classification.
Example 1: Nand Classification, 4 data points
Example 2: Randomly constructed binary classifiable example, 5 data points