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
About castTo() method #7753
Comments
What's the question here? The code is right there, you can see what it does. And in future, just link the code directly, don't copy/paste with bad formatting. Lines 6496 to 6506 in 64a17b5
|
(Force on no-empty), |
Yes, that's the way it is supposed to work - and (until now) the way I thought it already did. |
@OverRide
public INDArray castTo(DataType dataType) {
if(isEmpty()){
if(dataType == dataType())
return this;
return Nd4j.empty(dataType);
}
val result = Nd4j.createUninitialized(dataType, this.shape(), this.ordering());
result.assign(this);
return result;
}
If this data type is equal with the target's, must we create other instance?
I mean:
@OverRide
public INDArray castTo(DataType dataType) {
if(dataType == dataType())
return this;
... ...
The text was updated successfully, but these errors were encountered: