Comments (4)
Similar to the other issue, this one should be (mostly) implemented. I'll put my comments below since I definitely think there is room for improvement here! The methods are not implemented on the Tensor
, they are implemented as part of the Num
namespace.
puts Num.arange(3)
# Already works
puts Num.arange(3.0)
# Workaround would be Num.arange(3, dtype: Float32), but would welcome a PR to allow this
puts Num.arange(3,7)
# Already works
puts Num.arange(3,7,2)
# Already works
puts Num.arange(10, 5, -2)
# No negative step supported yet, but would welcome a PR to allow it
puts Num.arange(15, 10, 1)
# This will not be allowed, I raise an error if no values would be returned.
puts Num.arange(3, 6, 0.5)
# Workaround currently is Num.arange(3, 6, 0.5, dtype: Float32), but would welcome a PR to infer dtype from step
In general, similar to numpy
, when dealing with floats you want to use linspace
, which I do implement (Num.linspace
), although again, would welcome a PR to make the current arange
more consistent.
from num.cr.
Awesome! I can definitely look into getting a PR in to take care of the couple extra things in there. On a side note, I haven't really seen a statistics library for crystal. Is that something that might be of interest under the crystal-data organization? If yes, I'd be interested in starting to lay some groundwork for the basic functionality (basically working against the Matlab or numpy API as a model).
from num.cr.
I implement basic statistical methods such as min
, max
, mean
, std
(for entire Tensors and along axes), but not much beyond that. I think there is a definite need for that, and I would be very interested in having it included in Num.cr
, maybe Num::Stats
?
If it starts to become a massive module we could split it out into it's own library eventually, but to make sure it stays up to date with changes being made to Num
, probably better to keep them together right now.
If you wouldn't mind opening a new issue about the statistics library, with a brief roadmap of what you would like to see implemented, we can discuss it further there.
from num.cr.
To close out this issue, I ended up moving the range/n-space methods onto the Tensor itself, to take advantage of generic type inference. The methods have been removed from Num
.
Here is the code snippet you originally provided and its output with the current master branch:
puts Tensor.range(3)
puts Tensor.range(3.0)
puts Tensor.range(3,7)
puts Tensor.range(3,7,2)
puts Tensor.range(10, 5, -2)
puts Tensor.range(3.0, 6.0, 0.5) # All inputs must be same type here, minor change
# [0, 1, 2]
# [0, 1, 2] this is a float dtype, just represented like this because of nothing past decimal
# [3, 4, 5, 6]
# [3, 5]
# [10, 8, 6]
# [3 , 3.5, 4 , 4.5, 5 , 5.5]
from num.cr.
Related Issues (20)
- Tensor#matmul Error: undefined method 'buffer' for Tensor(Float32) HOT 3
- Transpose before matmul causes malformed result HOT 3
- 0.4.2
- Any chance of GRU/LSTM layers ? HOT 1
- Sparse matrices
- Add grad gates for trigonometric functions HOT 1
- Save Num::NN networks
- Standard backend for all Tensors
- Implement Num::NN without automatic differentiation
- Upgrade to Crystal v0.36.x HOT 1
- Use libblas as the default BLAS libaray HOT 2
- Documented tensor constructors missing in released num.cr HOT 4
- Version mismatch HOT 1
- CBlas import error HOT 1
- `matmul` not Defined for Float * Complex HOT 3
- CUDA support HOT 2
- Unary negation missing
- `log` and `tanh` not defined for `Num::Grad::Variable`
- `sum` and `mean` not defined for Num::Grad::Variable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from num.cr.