/// <summary> /// Creates a scalar <see cref="NDArray"/> of <see cref="value"/> and <see cref="dtype"/>. /// </summary> /// <param name="value">The value of the scalar</param> /// <returns></returns> /// <remarks>In case when <see cref="value"/> is not <see cref="dtype"/>, <see cref="Convert.ChangeType(object,System.Type)"/> will be called.</remarks> public static NDArray Scalar(object value) { return(new NDArray(UnmanagedStorage.Scalar(value))); }
/// <summary> /// Creates a scalar <see cref="NDArray"/> of <see cref="value"/> and <see cref="dtype"/>. /// </summary> /// <param name="value">The value of the scalar</param> /// <param name="dtype">The type of the scalar.</param> /// <returns></returns> /// <remarks>In case when <see cref="value"/> is not <see cref="dtype"/>, <see cref="Convert.ChangeType(object,System.Type)"/> will be called.</remarks> public static NDArray Scalar(object value, Type dtype) { return(new NDArray(UnmanagedStorage.Scalar(Convert.ChangeType(value, dtype)))); }
/// <summary> /// Creates a new <see cref="NDArray"/> with this storage. /// </summary> /// <param name="shape">The shape to set for this NDArray, does not perform checks.</param> /// <remarks>Doesn't copy. Does not perform checks for <paramref name="shape"/>.</remarks> protected internal NDArray(UnmanagedStorage storage, ref Shape shape) { Storage = storage.Alias(ref shape); tensorEngine = storage.Engine; }
public void Case10_Scalar() { var a = new UnmanagedStorage(17); AssertAreEqual(new int[] { 17 }, a.ToArray <int>()); }
/// <summary> /// Creates a new <see cref="NDArray"/> with this storage. /// </summary> /// <param name="storage"></param> protected internal NDArray(UnmanagedStorage storage) { Storage = storage; tensorEngine = storage.Engine; }