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

train_gtp2.c accesses parameters as arrays #257

Closed
wants to merge 4 commits into from

Conversation

zocterminal
Copy link
Contributor

Would you be interested in this patch, where I changed many of the functions that receive multidimensional arrays as parameters. I believe, since the C code seems mainly as an introduction to understand the process, this would make things much easier to read.

So, instead of doing the multiplications like in the original source, I'm declaring pointers to multidimensional arrays from the parameter, so that the source can use C array syntax like:

old:      float* out_bt = out + b * T * C + t * C;

new:      float* out_bt = &outBTC[b][t][0];

or

old:          int ix = inp[b * T + t];

new:          const int ix = inpBT[b][t];

There are a few still missing, but if you are interested, I would complete this.

Markus

@karpathy
Copy link
Owner

I don't super like it :) and I think it might look a bit less educational even because it obfuscates the fact that this is all just simple pointer arithmetic

@zocterminal
Copy link
Contributor Author

No worries then, I understand everyone has his/her own style and perception of code.

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

Successfully merging this pull request may close these issues.

2 participants