Skip to content

use reshape over view? any benefit to keep using view over reshape? #5684

@Joeycho

Description

@Joeycho

y_pred = y_pred.view(batch_size, n_class, -1)

Hi all,

I got view-size-is-not-compatible-with-input-tensors-size-and-stride error when using confusion_matrix.

Should we consider replacing view with reshape? or enforce contiguous() before view() operator? The reference is below.

https://discuss.pytorch.org/t/view-size-is-not-compatible-with-input-tensors-size-and-stride/121488/2?u=joeycho

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions