예제 #1
0
def test_num_passed_to_Tensor_creates_scalar_tensor(
        num: Union[primitive_types,
                   numpy_types], expected_java_class: str) -> None:
    t = Tensor(num)
    assert_java_class(t, expected_java_class)
    assert t.is_scalar()
    assert t.scalar() == num
예제 #2
0
def test_ndarray_passed_to_Tensor_creates_nonscalar_tensor(arr: primitive_types, expected_java_class: str) -> None:
    ndarray = np.array(arr)
    t = Tensor(ndarray)
    assert_java_class(t, expected_java_class)
    assert not t.is_scalar()
예제 #3
0
def test_ndarray_passed_to_Tensor_creates_nonscalar_tensor(arr: primitive_types) -> None:
    ndarray = np.array(arr)
    t = Tensor(ndarray)

    assert not t.is_scalar()
예제 #4
0
def test_num_passed_to_Tensor_creates_scalar_tensor(num: Union[primitive_types, numpy_types]) -> None:
    t = Tensor(num)
    assert t.is_scalar()
    assert t.scalar() == num