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
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
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
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
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