-
Notifications
You must be signed in to change notification settings - Fork 61
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
Updates/permute #10
base: main
Are you sure you want to change the base?
Updates/permute #10
Conversation
@@ -784,25 +784,12 @@ func NewTensor(ctx *Context, dt DType, dims uint32, ne0, ne1, ne2, ne3 uint32, d | |||
return &result | |||
} | |||
|
|||
// ggml_permute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to store original GGML function names for easier navigation between projects :)
func Permute(ctx *Context, a *Tensor, axis0, axis1, axis2, axis3 uint32) *Tensor { | ||
|
||
////ASSERT(axis0 >= 0 && axis0 < MAX_DIMS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And all the ASSERTs should be moved into special place to re-enable them on the graph init to be sure there no problems with dimensions and data types between tensors.
So yeah, the code is ugly right now, but please do not remove important parts which I'm going to move from there a bit later.
} | ||
|
||
target := rng.Float32() * cumulative[len(cumulative)-1] | ||
idx := sort.Search(len(cumulative), func(i int) bool { return cumulative[i] >= target }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this and seems, it doesn't doing well yet. Like this debug example, where most probable logit #0 was ignored and #4 with zero probability was chosen instead:
=== OLD === 0.017 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | === idx = 0 | logitsID = 372 | weight = 21.167
=== NEW === 0.017 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | === idx = 4 | logitsID = 756 | weight = 17.544
No description provided.