-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eduardo Leao
authored and
Eduardo Leao
committed
Mar 26, 2024
1 parent
7a23477
commit 43086a9
Showing
7 changed files
with
205 additions
and
32 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "js-pytorch", | ||
"version": "0.1.0", | ||
"description": "A JavaScript library like PyTorch, built from scratch.", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "node ./tests/test.js" | ||
}, | ||
"keywords": ["deep-learning", "machine-learning", "PyTorch"], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/eduardoleao052/js-torch.git" | ||
}, | ||
"author": "Eduardo Leitao da Cunha Opice Leao", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/eduardoleao052/js-torch/issues" | ||
}, | ||
"homepage": "https://github.com/eduardoleao052/js-torch#readme" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const torch = require('./tensor.js'); | ||
|
||
|
||
var jstorch = { | ||
// Add methods from tensor.js (these methods are accessed with "torch."): | ||
Tensor: torch.Tensor, | ||
Parameter: torch.Parameter, | ||
add: torch.add, | ||
neg: torch.neg, | ||
mul: torch.mul, | ||
div: torch.div, | ||
matMul: torch.matMul, | ||
exp: torch.exp, | ||
log: torch.log, | ||
sqrt: torch.sqrt, | ||
pow: torch.pow, | ||
mean: torch.mean, | ||
masked_fill: torch.masked_fill, | ||
variance: torch.variance, | ||
at: torch.at, | ||
reshape: torch.reshape, | ||
_reshape: torch._reshape, | ||
variance: torch.variance, | ||
transpose: torch.transpose, | ||
tensor: torch.tensor, | ||
randint: torch.randint, | ||
randn: torch.randn, | ||
rand: torch.rand, | ||
tril: torch.tril, | ||
ones: torch.ones, | ||
zeros: torch.zeros, | ||
tensor: torch.tensor, | ||
broadcast: torch.broadcast, | ||
// Add submodules: | ||
nn: require('./layers.js'), | ||
optim: require('./optim.js') | ||
|
||
}; | ||
|
||
if (typeof window !== 'undefined') { | ||
window.jstorch = jstorch; | ||
} else { | ||
module.exports = jstorch; | ||
}; |
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
Oops, something went wrong.