From c22bb00c03b59ce91c78a03072a281dfb0de5f2c Mon Sep 17 00:00:00 2001 From: Iain Moncrief Date: Thu, 22 Aug 2024 08:45:54 -1000 Subject: [PATCH] Add fix to ndarray casing --- lib/NDArray.chpl | 3 ++- lib/StaticTensor.chpl | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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) {