Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*fix bug: segmentation fault at test case #438

Merged
merged 1 commit into from Mar 11, 2019
Merged

Conversation

joddiy
Copy link
Member

@joddiy joddiy commented Mar 7, 2019

*fix bug:
- allow reshaping on an empty tensor then give it data will invoke segmentation fault.
*how to fix:
- when reshape, add a check requiring the original shape's volume must be same with new one.
- fix corresponding test case(test_mse, test_cross_entropy, test_tensor_math)

    - allow reshaping on a empty tensor then give it data will invoke segmentation fault.
*how to fix:
    - when reshape, add a check requiring the original shape's volume must be same with new one.
    - fix corresponding test case(test_mse, test_cross_entropy, test_tensor_math)
@nudles
Copy link
Member

nudles commented Mar 11, 2019

The tranpose operation should return a new tensor that shares the data with this tensor if possible; otherwise return a new tensor that copies the data.

@joddiy
Copy link
Member Author

joddiy commented Mar 11, 2019

The transpose is another problem, I think yisen will submit a new PR(otherwise I'll simbit a new PR to copy that).

@nudles
Copy link
Member

nudles commented Mar 11, 2019

maybe the current transpose implementation is ok. T() and Tensor::Transpose() change itself. The global transpose return a view if possible. No need to change now.

@nudles nudles merged commit 5cebbd6 into apache:master Mar 11, 2019
@joddiy
Copy link
Member Author

joddiy commented Mar 11, 2019

But the current transpose implementation cannot pass the test case. The test case
Tensor o = t.T(); EXPECT_EQ(t.shape()[0], o.shape()[1]); EXPECT_EQ(t.shape()[1], o.shape()[0]);
seems the transpose func needs to return a new transposed tensor, rather than change itself.

This was referenced Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants