diff --git a/lib/NDArray.chpl b/lib/NDArray.chpl index b3a367f4f..a849957b8 100644 --- a/lib/NDArray.chpl +++ b/lib/NDArray.chpl @@ -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); } diff --git a/lib/StaticTensor.chpl b/lib/StaticTensor.chpl index 292d2be11..fede12dad 100644 --- a/lib/StaticTensor.chpl +++ b/lib/StaticTensor.chpl @@ -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; @@ -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) {