Skip to content

np.expand_dims takes tuples #7

@chillenzer

Description

@chillenzer

Replace the two calls to np.expand_dims with one call with axis=<tuple>, i.e.

matrix_weights = np.expand_dims(
    [[0, 2, 0], [1, 0, 3]], axis=(2, 3)
)
values_4d * matrix_weights

instead of the currently present

matrix_weights = np.expand_dims(np.expand_dims(
    [[0, 2, 0], [1, 0, 3]], axis=2), axis=3
)
values_4d * matrix_weights

in Broadcasting.

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