Skip to content

Puzzle 15 & 16 run_test issues #14

@javadr

Description

@javadr

Thanks a lot for this great mind-baffling puzzle.
I am kinda got stuck with problems 15 and 16 as it throws:

RuntimeError: expand(torch.LongTensor{[1, 5]}, size=[5]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

I have used the following for puzzles 15 and 16, respectively:

def bincount(a: TT["i"], j: int) -> TT["j"]:
    return ones(a.shape[0])[None,:] @ ((a[:,None]==arange(j))*1)

and

def scatter_add(values: TT["i"], link: TT["i"], j: int) -> TT["j"]:
    return values[None,:] @ ((link[:,None]==arange(j))*1)

While both work like a charm in the first part, the run_test part throws a runtime error!
I can't figure out what the problem is.
Could you please help me with this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions