Comments (8)
I agree the shape argument is arbitrary. It also implies that we can only return a single tensor which is also arbitrary.
Note that Flax is using the initializers from jax.nn.initializers
so that create some difficulty when we want to reuse those.
An alternative that is less invasive is the following:
Change the current param api:
def param(self, shape, init_fn):
...
init_value = init_fn(rng, shape)
to:
def param(self[, shape=None], init_fn):
if shape is None:
init_value = init_fn(rng):
else:
init_value = init_fn(rng, shape)
from flax.
Isn't
def param(self, shape=None, init_fn):
a SyntaxError? Just wondering if there's a way around that...
from flax.
Note that Flax is using the initializers from jax.nn.initializers so that create some difficulty when we want to reuse those.
I think it's pretty straightforward to wrap the JAX initializers though.
from flax.
Isn't
def param(self, shape=None, init_fn):a SyntaxError? Just wondering if there's a way around that...
Yes you have to implement some manual argument unpacking to get that working. With the brackets I meant the param method is basically overloaded so you have either
param(name, shape, init_fn)
or
param(name, init_fn)
we could also decide to give the second option a different name.
from flax.
from flax.
If both Flax and Haiku want a different jax.nn.initializers
API we should maybe switch it...
from flax.
@jekbradbury - oh, do haiku peeps also want a different initializer api?
from flax.
This has been resolved (with an improved shape check) in #530
from flax.
Related Issues (20)
- Feature request: Add ConvGRUCell
- The Error in FLOP Computation of Model Tabulate Function HOT 1
- Make redundant `features` argument optional for recurrent cells HOT 2
- Add `reset_gate` flag to `MGUCell` HOT 4
- Unify behavior of strides arg of Conv and ConvTranspose HOT 1
- modifying params of flax.linen. Module model HOT 1
- Error when calling module tabulate involving WeightNorm HOT 5
- Compatibility with Torch LSTM HOT 2
- Wrong parameter names when nesting Modules within flax transformations HOT 3
- Neural Net Training is bottlenecked by maxed out CPU
- Error occurs in `nn.vmap` while `variable_axes` is a nested dict HOT 1
- flax.linen.module.init still fails under dynamic type checking for nested modules
- *Module Parameters* section of docs is outdated. HOT 4
- More memory consume compared with Pytorch HOT 1
- Difference in output between jitted and non-jitted call
- Error when calling `Module.tabulate` on normalization wrappers like `WeightNorm` and `SpectralNorm`
- Orbax checkpoint for LogicallyPartitioned params HOT 2
- For some reason these imports are elided on read the docs
- Using variable declared at a broader scope in a function is bad form HOT 1
- Add `BatchRenorm` layer to `linen.normalization`
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 flax.