def __init__(self, sharding_spec: ShardingSpec, *size, tensor_init_params: TensorInitParams, process_group=None, init_rrefs=False):
    self._prepare_init(process_group=process_group, init_rrefs=init_rrefs)
    if (tensor_init_params.tensor_properties is None):
        raise ValueError('tensor_properties must not be None.')
    if (tensor_init_params.tensor_properties.dtype is None):
        tensor_init_params.tensor_properties.dtype = torch.get_default_dtype()
    if (tensor_init_params.tensor_properties.layout != torch.strided):
        raise ValueError('Only torch.strided layout is currently supported')
    if (tensor_init_params.tensor_properties.memory_format != torch.contiguous_format):
        raise ValueError('Only torch.contiguous_format memory_format is currently supported')
    dims = _flatten_tensor_size(size)
    self._sharding_spec = sharding_spec
    if isinstance(self._sharding_spec, ChunkShardingSpec):
        self._init_chunked(dims, tensor_init_params)
    elif isinstance(self._sharding_spec, EnumerableShardingSpec):
        self._init_enumerable(dims, tensor_init_params)
    else:
        raise ValueError(f'Unsupported sharding_spec: {self._sharding_spec}')
    self._post_init()
def __init__(self, sharding_spec: ShardingSpec, *size, tensor_init_params: TensorInitParams, process_group=None, init_rrefs=False):
    self._prepare_init(process_group=process_group, init_rrefs=init_rrefs)
    if (tensor_init_params.tensor_properties is None):
        raise ValueError('tensor_properties must not be None.')
    if (tensor_init_params.tensor_properties.dtype is None):
        tensor_init_params.tensor_properties.dtype = torch.get_default_dtype()
    if (tensor_init_params.tensor_properties.layout != torch.strided):
        raise ValueError('Only torch.strided layout is currently supported')
    if (tensor_init_params.tensor_properties.memory_format != torch.contiguous_format):
        raise ValueError('Only torch.contiguous_format memory_format is currently supported')
    dims = _flatten_tensor_size(size)
    self._sharding_spec = sharding_spec
    if isinstance(self._sharding_spec, ChunkShardingSpec):
        self._init_chunked(dims, tensor_init_params)
    elif isinstance(self._sharding_spec, EnumerableShardingSpec):
        self._init_enumerable(dims, tensor_init_params)
    else:
        raise ValueError(f'Unsupported sharding_spec: {self._sharding_spec}')
    self._post_init()