public static T ToScalar <T>(this Context context, Tensor <T> tensor) { var array = context.ToArray(tensor); return(array[0]); }