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

Updates/permute #10

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

mfreeman451
Copy link
Contributor

No description provided.

@@ -784,25 +784,12 @@ func NewTensor(ctx *Context, dt DType, dims uint32, ne0, ne1, ne2, ne3 uint32, d
return &result
}

// ggml_permute
Copy link
Owner

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);
Copy link
Owner

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 })
Copy link
Owner

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

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.

None yet

2 participants