コード例 #1
0
def _test_flow_var_0_size_data_with_random_data(test_case, placement, sbp):
    x = random_tensor(4, 8, 16, 0, 8).to_global(placement, sbp)
    y = torch.var(
        x,
        dim=random(low=0, high=4).to(int),
        unbiased=random().to(bool),
        keepdim=random().to(bool),
    )
    return y
コード例 #2
0
ファイル: test_var.py プロジェクト: ZJLabDubhe/oneflow-zj
 def test_flow_var_0_size_data_with_random_data(test_case):
     device = random_device()
     x = random_tensor(4, 2, 3, 0, 4).to(device)
     y = torch.var(
         x,
         dim=random(low=-4, high=4).to(int),
         unbiased=random().to(bool),
         keepdim=random().to(bool),
     )
     return y
コード例 #3
0
ファイル: test_var.py プロジェクト: zzk0/oneflow
 def test_flow_var_one_dim_with_random_data(test_case):
     device = random_device()
     x = random_tensor(ndim=4).to(device)
     y = torch.var(
         x,
         dim=random(low=0, high=4).to(int),
         unbiased=random().to(bool),
         keepdim=random().to(bool),
     )
     return y
コード例 #4
0
def _test_flow_global_var_all_dim_with_random_data(test_case, placement, sbp):
    x = random_tensor(
        ndim=4,
        dim0=random(1, 3).to(int) * 8,
        dim1=random(1, 3).to(int) * 8,
        dim2=random(1, 3).to(int) * 8,
        dim3=random(1, 3).to(int) * 8,
    ).to_global(placement, sbp)
    y = torch.var(x)
    return y
コード例 #5
0
def _test_flow_global_var_one_dim_with_random_data(test_case, placement, sbp):
    x = random_tensor(
        ndim=4,
        dim0=random(1, 3).to(int) * 8,
        dim1=random(1, 3).to(int) * 8,
        dim2=random(1, 3).to(int) * 8,
        dim3=random(1, 3).to(int) * 8,
    ).to_global(placement, sbp)
    y = torch.var(
        x,
        dim=random(low=0, high=4).to(int),
        unbiased=random().to(bool),
        keepdim=random().to(bool),
    )
    return y