Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to copy a network to another? #25

Open
cgraider opened this issue May 9, 2023 · 1 comment
Open

How to copy a network to another? #25

cgraider opened this issue May 9, 2023 · 1 comment

Comments

@cgraider
Copy link

cgraider commented May 9, 2023

Hi, i'm trying to copy a network to another
this code gives me error :
cannot be assigned because its copy assignment is implicitly deleted

this->net = this->targetnet;

if its not possible at least i need to copy weights

@rkuang9
Copy link

rkuang9 commented May 24, 2023

Since the Net's layers are stored as an array of pointers, they cannot simply be copied with the default copy constructor. You have to copy each layer's weights individually. You can either use get_parameters() or add your own get_weights() which can return a vector of matrices (weights and bias).

Might I suggest this library, https://github.com/rkuang9/FLARE. It allows you to save weights to a file and load from them. It offers more functionality like convolution, convolution transpose, LSTM, GRU, BiRNN (and Multihead Attention soon) and uses tensors instead of being limited to matrix and vectors. If you've used TensorFlow or PyTorch, this library will be familiar. It's easy to add to your project with CMake and there are examples to get you started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants