Comments (4)
I think that the constant float / torch.nn.Parameter needs to be unsqueezed and then the 0-th dimension needs to be blown up to the batch dimension. Something like this:
self._output_str = 'torch.cat(x.shape[0] * [self._p{}.unsqueeze(0)])'.format(self._idx)
from hal-cgp.
i'm not even sure what the CGPConstantFloat.format_output_str_torch
method does, is it even used? it does not make use of the actual value of the node (self._output
) but only of the node index to define a new member variable. maybe that function should never be called in the first place (add raise ...
?), but only the function format_parameter_str
that should actually be called format_parameter_str_torch
? in this function, one could just resize the tensor to include a batch dimension, correct?
from hal-cgp.
As far as I understand, the CGPConstantFloat.format_output_str_torch
is called in CGPGraph.compile_torch_class()
when the forward
method of the torch class is written:
https://github.com/jakobj/python-gp/blob/3bdff24be10ef503652b44b0be1606a639555627/gp/cgp_graph.py#L218
This function calls format_output_str_torch
is called on the output nodes here which call this method on their input nodes leading to a recursive call.
On the other hand, the format_parameter_str
method is used to construct the __init__()
method of the torch class:
https://github.com/jakobj/python-gp/blob/3bdff24be10ef503652b44b0be1606a639555627/gp/cgp_graph.py#L200
This makes sense because in the __init__()
method, the constant float has to be defined (for example set to 1.0) and then in the forward method it is used.
from hal-cgp.
ah i see, thanks for explaining! who the hell wrote that code? ;)
from hal-cgp.
Related Issues (20)
- Always use "reorder=True" and remove possiblity to configure this? HOT 2
- Remove github pages
- Slow process startup time in OSX
- Make sure caching decorator's key from numpy evaluation contains not only nan
- Default `Population` and `MuPlusLambda` objects in `evolve` are persistent
- Include MacOS in CI
- Remove `n_rows` and `levels_back` parameters HOT 2
- Run code checks in workflow separately
- CI should make sure all examples are working properly
- New example: scaled symbolic regression
- Evaluation in C with multiple output nodes
- Unfreeze dependencies
- Hurdles relative to champion fitness
- Warn if `pop.generation` is not zero at call to `evolve`
- Local search randomly over a set of values
- Assert runtime invariant: all individuals in `MuPlusLambda::step` need to have a non-None index HOT 3
- Pip install hal-cgp doesnot work HOT 1
- No example is running on my system HOT 1
- Fails if n_processes>1, Why ? How to solve? HOT 3
- How can we use logical operators ? Need urgent help HOT 4
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 hal-cgp.