Skip to content

apply broadcasting for other operations (+,-,*,/) #11

@kellen-sun

Description

@kellen-sun

Currently, when applying a matmul, we allow for "broadcasting" (read up on numpy or pytorch broadcasting if need be). This basically lets us promote an array. Say we're multiplying (5, 4, 6) with (6, 7); we'll have an invisible (1, ..) in the second matrix, and then we'll use it to multiply with each of the 5 "batches" that we have from the first tensor. To get the final shape of (5, 4, 7).

This task is to basically consider similar broadcasting rules (add invisible 1s, and promote 1s to the other shape's dimension) for other operations, for now the basic arithmetic pointwise ones.

We also do something similar when slicing and assigning values. If we have a[smth] = b, the shapes should get broadcast on this assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions