-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They key word is `abstract type`, `abstract` or `type` alone can be defined as new bindings
- Loading branch information
1 parent
1a13c19
commit 6b98624
Showing
3 changed files
with
86 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
% Implementing Feed Forward to calculate H | ||
% Defining basic types | ||
|
||
m = size(X, 1); | ||
X = [ones(m, 1) X]; | ||
Z2 = Theta1 * X'; | ||
A2 = sigmoid(Z2); | ||
struct Value | ||
v::Int | ||
end | ||
const r = 33 | ||
|
||
A = zeros(3,3) | ||
B = rand(4,3) | ||
|
||
type = typeof(B) | ||
C = A * B' | ||
res = C' .+ r | ||
|
||
const abstract = 33 | ||
abstract type K end | ||
|
||
primitive type MyFloat32 32 end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,103 @@ | ||
[ | ||
{"type":"Operator","value":"%"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Implementing"}, | ||
{"type":"Name","value":"Defining"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Feed"}, | ||
{"type":"Name","value":"basic"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Forward"}, | ||
{"type":"Name","value":"types"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"Keyword","value":"struct"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Value"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Name","value":"v"}, | ||
{"type":"Operator","value":"::"}, | ||
{"type":"KeywordType","value":"Int"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Keyword","value":"end"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"KeywordDeclaration","value":"const"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"to"}, | ||
{"type":"Name","value":"r"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"calculate"}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"H"}, | ||
{"type":"LiteralNumberInteger","value":"33"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"Name","value":"m"}, | ||
{"type":"Name","value":"A"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"size"}, | ||
{"type":"Name","value":"zeros"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"X"}, | ||
{"type":"LiteralNumberInteger","value":"3"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"Punctuation","value":");"}, | ||
{"type":"LiteralNumberInteger","value":"3"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Name","value":"X"}, | ||
{"type":"Name","value":"B"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"["}, | ||
{"type":"Name","value":"ones"}, | ||
{"type":"Name","value":"rand"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"m"}, | ||
{"type":"LiteralNumberInteger","value":"4"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"LiteralNumberInteger","value":"3"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"Name","value":"type"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"X"}, | ||
{"type":"Punctuation","value":"];"}, | ||
{"type":"Name","value":"typeof"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"B"}, | ||
{"type":"Punctuation","value":")"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Name","value":"Z2"}, | ||
{"type":"Name","value":"C"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Theta1"}, | ||
{"type":"Name","value":"A"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"*"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"X"}, | ||
{"type":"Name","value":"B"}, | ||
{"type":"Operator","value":"'"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Name","value":"A2"}, | ||
{"type":"Name","value":"res"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"sigmoid"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"Name","value":"Z2"}, | ||
{"type":"Punctuation","value":");"} | ||
{"type":"Name","value":"C"}, | ||
{"type":"Operator","value":"'"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":".+"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"r"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"KeywordDeclaration","value":"const"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"abstract"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"33"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Keyword","value":"abstract type"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"K"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"end"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"Keyword","value":"primitive type"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"MyFloat32"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumberInteger","value":"32"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"end"}, | ||
{"type":"Text","value":"\n"} | ||
] |