Skip to content

Commit

Permalink
Add fix to ndarray casing
Browse files Browse the repository at this point in the history
  • Loading branch information
Iainmon committed Aug 22, 2024
1 parent 7a875ce commit c22bb00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/NDArray.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ operator :(const val: [] ?eltType, type t: ndarray(val.rank,eltType)) do
return new ndarray(val);

operator :(const a: ndarray(?rank,?eltType),type toType): ndarray(rank,toType) where toType != eltType {
const D = a.data : toType;
const A = a.data;
const D = A : toType;
return new ndarray(D);
}

Expand Down
6 changes: 4 additions & 2 deletions lib/StaticTensor.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ record tensor : serializable {
forwarding resource only to, array, grad, device ;//backward;
proc meta do return this.resource;

proc _dom do return this.array.domain;
proc _dom do return resource.array.domain;

proc init(param rank: int, type eltType = real(64)) {
this.rank = rank;
Expand Down Expand Up @@ -82,7 +82,9 @@ record tensor : serializable {
}

operator :(in t: tensor(?rank,?eltType), type toType): tensor(rank,toType) {
return new tensor(t.array : toType);
const a = t.array;
const b = a : toType;
return new tensor(b);
}

proc tensorFromCtx(param rank: int, type eltType, ctx): tensor(rank,eltType) {
Expand Down

0 comments on commit c22bb00

Please sign in to comment.