Comments (10)
I admit to initially being confused about NewMatrix/Vector - you're right that it does not intuitively suggest node creation. How about having all those routines begin with NewNodeFrom... and NewNodeOf... ?
x:= NewNodeOfVector(g, Float64, 5, WithName("x"))
y:= NewNodeFromVector(g, x, WithName("y"))
It is quite verbose, but given that these are among the first functions any (new) user would have to call, making them easy to understand might be worth it.
from gorgonia.
Changed
x := IsAVector(g, Float64, 5, WithName("x"))
y := IsAMatrix(g, Flaot32, 2, 3, WithName("y"), WithValue(yT))
to
x := Vector(g, Float64, 5, WithName("x"))
y := Matrix(g, Flaot32, 2, 3, WithName("y"), WithValue(yT))
Reason: IsAVector
looks like it should return a bool and is hence confusing.
Cons: now it looks like what I really don't like: Theano's syntax.
from gorgonia.
I like the idea of NewNodeOf
. Clean. Explains itself well. As for the one that has "from"... I think adopting the NodeFromXXX
pattern would be cleaner - drop the "the" "new
from gorgonia.
Changed
x := Vector(g, Float64, 5, WithName("x"))
y := Matrix(g, Flaot32, 2, 3, WithName("y"), WithValue(yT))
to
x := NewNodeOfVector(g, Float64, 5, WithName("x"))
y := NewNodeOfMatrix(g, Float32, 2, 3, WithName("y"), WithValue(yT))
or
x := NodeOfVector(g, Float64, 5, WithName("x"))
y := NodeOfMatrix(g, Float32, 2, 3, WithName("y"), WithValue(yT))
@kabaka0 made some very good points in the comments above.
from gorgonia.
Would it be possible to unify the node creation functions into something like NewNodeFromTensor
? Then, for instance, a scalar would just be a 1x1 tensor. Is there any reason why the functions to create a "matrix node" are separate from those that create a "tensor node" or a "scalar node"? Maybe it's a naive question, since I am totally new to the library ;-)
from gorgonia.
https://godoc.org/gorgonia.org/gorgonia#NodeFromAny
Also the reason for having Scalar value vs Scalar represented as a tensor.Tensor
type is that the usual tensor.Tensor
is tensor.Dense
, which requires A LOT of allocation.
from gorgonia.
Ok, thanks for clarifying this. So, in principle I guess I could always use NodeFromAny
to create a scalar-matrix-tensor node, since it takes care of calling the appropriate NewScalar
or NewTensor
functions. I understand that it's better to have a dedicated function to build scalar nodes (instead of representing them as tensors) for memory allocation, but if I understand correctly, NewMatrix
and NewVector
are just wrappers for NewTensor
, so they are separate functions just for convenience, not to save memory.
from gorgonia.
NewMatrix
andNewVector
are just wrappers forNewTensor
, so they are separate functions just for convenience, not to save memory.
Specifically the convenience is not having to specify how many dimensions
from gorgonia.
Good. Do you think it would be worth explaining the rationale behind these functions somewhere in the gorgonia.org website?
from gorgonia.
OH YES!
from gorgonia.
Related Issues (20)
- Inference in go (trained in python and deploy in golang) HOT 1
- I need help deploying NLP and Neural Network model HOT 1
- Getting start code failed to run HOT 1
- Stacking multiple tensors
- Unable to import gorgonia.org/gorgonia/examples/mnist HOT 3
- There is an inexplicable error when running convnet_cuda, and I have no clue to solve it. Can you provide some ideas? HOT 3
- Load model from redisai HOT 3
- convnet with cuda (v11) support not working HOT 2
- If there is any function would be used like deconv2D?
- examples/charRNN Crashes When Run HOT 5
- Critical dualValue bug? HOT 7
- No examples folder for v0.9.16 and v0.9.17
- Unexpected behaviour with Add() and Sub()
- "go get -u gorgonia.org/gorgonia" - error undefined: arrowArray.Interface HOT 1
- panic on parallel runner HOT 1
- Support for OpenCL and multiple GPUs, such as Intel Graphics and AMD. HOT 1
- BatchedMatMul bug when applying to 1-shape matrix
- Please may you tag a new version HOT 1
- OneHot op
- Using a node twice without it getting changed in-place HOT 1
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 gorgonia.