Skip to content

The Resize function doesn't change stride_ if resize_type == kSetZero and rows == MatrixBase<Real>::num_rows_ && cols == MatrixBase<Real>::num_cols_. #4904

@moshimo2019

Description

@moshimo2019
          The `Resize` function doesn't change `stride_` if resize_type == kSetZero and `rows == MatrixBase<Real>::num_rows_ && cols == MatrixBase<Real>::num_cols_`.

The following code will crash if the column of the matrix to be loaded isn't multiple of 4

kaldi::Matrix<kaldi::BaseFloat> sli(0, 0, kaldi::kSetZero, kaldi::kStrideEqualNumCols);
std::ifstream ifs("matrix.txt");
sli.Read(ifs, false);
sli.Resize(sli.NumRows(), sli.NumCols(), kaldi::kSetZero, kaldi::kStrideEqualNumCols);
assert(sli.NumCols() == sli.Stride());

Originally posted by @moshimo2019 in #2025 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleStale bot on the loose

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions