{'fraction_non_alphanumeric': 0.029735857014815206, 'fraction_numerical': 0.0075394105551747775, 'mean_word_length': 4.446518305814788, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Reconfigurable Intelligent Surface Enabled Spatial Multiplexing with Fully Convolutional Network

Reconfigurable intelligent surface (RIS) is an emerging technology for future wireless communication systems. In this work, we consider downlink spatial multiplexing enabled by the RIS for weighted sum-rate (WSR) maximization. In the literature, most solutions use alternating gradient-based optimization, which has moderate performance, high complexity, and limited scalability. We propose to apply a fully convolutional network (FCN) to solve this problem, which was originally designed for semantic segmentation of images. The rectangular shape of the RIS and the spatial correlation of channels with adjacent RIS antennas due to the short distance between them encourage us to apply it for the RIS configuration. We design a set of channel features that includes both cascaded channels via the RIS and the direct channel. In the base station (BS), the differentiable minimum mean squared error (MMSE) precoder is used for pretraining and the weighted minimum mean squared error (WMMSE) precoder is then applied for fine-tuning, which is nondifferentiable, more complex, but achieves a better performance. Evaluation results show that the proposed solution has higher performance and allows for a faster evaluation than the baselines. Hence it scales better to a large number of antennas, advancing the RIS one step closer to practical deployment.


I. INTRODUCTION
The reconfigurable intelligent surface (RIS) is an emerging technology for next-generation wireless communication systems [1]- [3]. It comprises many antennas on a surface. Each antenna has the ability to receive a signal, process it without external power (i.e., the signal cannot be amplified), and reflect it. With cooperation between the antennas, the RIS can realize complicated signal processing. Due to its simple structure and good compatibility the high complexity constrains the number of RIS antennas. In most works mentioned above, the number of RIS antennas is assumed to be less than 200, which is far less than the vision of up to thousands of elements introduced in Ref. [2]. In recent years, there have been attempts to apply machine learning to RIS optimization for better scalability. For example, meta-learning is used to optimize the spectrum efficiency but only one user per RIS is considered in [28], a reflection beamforming codebook is learnt with DRL for groups of users [29] (no spatial multiplexing is considered though), the achievable rate is predicted with user location and beamforming in [30].
In this work, we propose an approach based on fully convolutional network (FCN) and WMMSE precoding that achieves better performance with less operating expenses. The FCN is comprised of multiple convolutional layers and was first proposed in [31] and is successfully applied for semantic segmentation and depth estimation [32], where an image is fed into the neural network as input and the category (for semantic segmentation, categories are, e.g., the car, the road, or the sky) or the depth (for depth estimation, which is the distance between the camera and the object) of each pixel of the image is estimated as output. The first convolutional layer is able to extract the local features of the image while the following convolutional layers can process information on higher levels. Inspired by the rectangular shape of the RIS and the spatial correlation of the channels of adjacent RIS antennas due to the close distance between the antennas [33], we apply an FCN for the RIS configuration. In the literature, the FCN has been applied to object detection [34], visual tracking [35] and receiver design [36] besides the above-mentioned applications. To the authors' best knowledge, it has not yet been applied to RIS configuration.
Our contributions in this paper are as follows: • We apply an FCN for the RIS configuration. We show that the FCN is an efficient and scalable architecture for the considered WSR maximization problem. By introducing dropout layers, we prevent overfitting and improve the generalization of the trained models. • We design a trick to consider the direct channel without RIS in the FCN, which makes the proposed approach more applicable because a weak direct channel exists in most use cases. • We design a training process with the WMMSE precoder, which is nondifferentiable and therefore incompatible with the gradient ascent optimization. By alternatingly training the FCN and updating the precoding vectors, the FCN can work properly with the WMMSE precoder.
• We propose a method to discretize the output phase shifts with low resolution (e.g., π with binary, small codebook size) such that the solution can be applied to RIS with simple and cheap discrete phase shifts. The proposed method uses the Frobenius norm as a penalty and aims to minimize the performance loss compared to the continuous phase shift.
In the following part of this work, Section II formulates the problem, Section III describes the precoding techniques, Section IV proposes our solution, Section V explains some issues of implementation and training and extends the method to discrete phase shifts, Section VI presents the training and evaluation results and Section VII concludes the work.
Notations: Throughout this work, we use the following notations: I n is an identity matrix of size n × n, 0 n is a zero matrix of size n × n, A B denotes the 2-dimensional cross-correlation between A and B, |z| and arg(z) are the amplitude and phase of complex number z, respectively, A + denotes the pseudoinverse of matrix A,θ refers to the untrainable neural network parameter set θ (i.e., it is considered constant during training), exp(A) is the elementwise exponential function.

II. PROBLEM FORMULATION
We consider an RIS-aided communication with direct propagation path between BS and users. Our objective is to serve multiple users with the same resource block and to maximize the WSR of the users. The BS is assumed to have multiple antennas and can do precoding subject to the transmit power constraint E T r . The RIS is assumed to be rectangular with H rows and W columns of antennas. Each RIS antenna has the ability to receive signal, adjust its complex phase without changing its amplitude and transmit it.
We denote the precoding matrix as V of size M × U , where M is the number of BS antennas, U is the number of single-antenna users, the channel from BS to RIS as H of size N × M , where N is the number of RIS antennas (N = W H) and element h nm in row n and column m represents the channel gain from the mth antenna of the BS to the nth antenna of the RIS. The RIS signal processing is denoted by the diagonal matrix Φ of size N × N , where the element φ nn in row n and column n is e jψn , with ψ n being the phase shift of antenna n. We consider both continuous and discrete phase shift in this work. If the phase shift is continuous, ψ n ∈ [0, 2π). If the phase shift is discrete, ψ n ∈ Φ d , where Φ d is the set of predefined discrete phase shifts. The channel matrix from RIS to users is denoted as G of size U × N , where the element g un denotes the channel gain from RIS antenna n to user u. The direct channel from BS to users is denoted as D of size U × M , where the element d um in row u and column m is the channel gain from the mth BS antenna to the uth user, the transmission is described as where x is the vector of transmitted symbols, y is the vector of received symbols and n is the vector of thermal noise. All three vectors have the same size of U × 1. The whole system model is illustrated in Fig. 1.
and c uv being the element of C in row u and column v, the objective is to maximize the WSR. Therefore, the problem can be formulated as where α u is weight of user u, α u ∈ [0, 1] and U u=1 α u = 1, and ρ is the transmit signal-to-noise ratio (TSNR), which is the ratio between transmit power and noise power.

III. THE MMSE AND WMMSE PRECODER
In problem (3), H, G and D are given and we would like to optimize both V and Φ. While the RIS optimization problem (i.e., optimizing Φ) is new, the precoding problem (i.e., optimizing V) has been intensively studied in the literature. Different precoding techniques, such as maximum ratio transmission (MRT), zero-forcing (ZF), MMSE and WMMSE are proposed. Among them, the MMSE precoder can minimize the mean squared error caused by both interference and noise with a closed form solution and is the optimal precoder for a single user [12]. The iterative WMMSE precoder introduces weights of the mean squared errors (MSEs) of different users in the multiuser multiple-input-multiple-output (MIMO) system. It is proven that minimizing the sum of weighted MSEs for certain weights is equivalent to maximizing the WSR [15]. However, the WMMSE precoder does not have a closedform solution and is only available as an iterative algorithm, which significantly increases its complexity compared to the MMSE precoder. Accordingly we cannot compute its derivative. In the following, we briefly introduce the two precoders that will be applied jointly with the RIS optimization.

A. The MMSE Precoder
In the MMSE precoder, the error is defined as the difference between transmitted symbols x and received symbols y scaled by a proper factor β −1 (because the received symbols are weaker due to the propagation loss). Accordingly, the MSE is defined as The objective is to minimize the MSE subject to the transmit power constraint: When we assume E(x · x T ) = I 2 , E(n · n T ) = 1/ρ · I 2 and E(n · x T ) = 0 2 , we obtain a closed-form solution [12] where 6 The MMSE precoder is the optimal precoder to maximize the data rate for a single user. However, it uses the same scalar β −1 to scale all received symbols of multiple users. If the received symbols at different users have very different signal strengths due to different channel gains, the MMSE precoder is forced to equalize the channel gains, which results in a suboptimal performance. Besides, it minimizes the sum of mean squared errors of all users.
If we would like to optimize the WSR, the weights (i.e., α u in (3)) cannot be considered in the MMSE precoder.
Therefore, the MMSE precoder is not the optimal precoder to maximize the WSR with multiple users. Nevertheless, it is still a good choice due to its satisfying performance and simple, closed form (and therefore differentiable) solution.

B. The WMMSE Precoder
Similar to the MMSE precoder, we define the error of user u as where ξ u is the scaling factor of user u (corresponding to β −1 in (4) but can be different for different users), y u is the received symbol of user u (i.e., the uth element of y in (1)) and x u is the transmitted symbol of user u (i.e., the uth element of x in (1)).
The WMMSE precoder considers the following problem where w u is the weight of the MSE of user u, U is the number of users, v u is the precoding vector for user u of size M × 1 (i.e., the uth column of V in (1)). It is proven that problem (9) is equivalent to the problem of WSR maximization (3) (when Φ is fixed) in the sense that their optimal solutions of w u and v u are the same when ξ u is carefully selected for all users u.
Unfortunately, there is no closed-form solution to (9). Instead, Algorithm 1 is proposed to iteratively solve problem (9), where we define c u as the channel to user u of size 1 × M (i.e., the uth row of C), µ * is the Lagrange multiplier of the power constraint and is chosen such that the transmit power constraint in (9) is satisfied.
The WMMSE precoder is the optimal precoder to maximize the WSR (see Theorem 1 in [15] for details).
However, its complexity is considerably higher than the MMSE precoder. Besides, the iterative solution is not differentiable.

A. The FCN Approach
An FCN consists of several two-dimensional convolutional layers, where each layer processes the feature maps of its preceding layer and extracts new feature maps from them. For example, in semantic segmentation and depth estimation, usually an RGB image is used as input for the network. The filters in the first layer operate on the three color channels of the image and extract feature maps for the following convolutional layer. The filter kernels learned in the first layer are three-dimensional as they extract features from a three-dimensional input tensor. Each filter kernel generates one output feature map. The output of a semantic segmentation FCN in a certain task is a category for each pixel (e.g., road, car, pedestrian) wheres the output of a depth segmentation FCN is the estimated depth for each pixel. The channels H and G reveal spatial correlation due to the short distance between RIS antennas. This property shows similarity to images, where adjacent pixels form an object, which can be captured by a two-dimensional convolutional filter, thereby justifying the choice of an FCN architecture. The optimal output of each RIS antenna depends on both its own feature and features of other antennas, which is the same to semantic segmentation and depth estimation 1 . Encouraged by these analogies, we would like to compute Φ with the FCN.
The elementary unit of an RIS is an RIS antenna. Its features are the properties characterizing the wireless channels with respect to this RIS antenna, which will be defined later in Section IV-B. Other conventional neural network architectures, such as neural networks with dense layers would not work for such high-dimensional input and output.
As shown in Fig. 2(a), the input of the FCN is a three-dimensional array, where the first dimension is the feature map index k ∈ {1, . . . , K} with K the number of features, second and third dimensions are height h ∈ {1, . . . , H} and width w ∈ {1, . . . , W }, respectively. For example, the value of feature map index k of the RIS antenna at position (h, w) is stored in coordinate (k, h, w) in the three-dimensional array. The output of the FCN is a twodimensional array of the same height and width as the input, but with only one feature map being the phase shift of the antenna, as shown in Fig. 2 Define Q τ as the τ th feature map of the output of a convolutional layer. It is computed as where b τ is the bias of feature map with index τ , W kτ is the filter kernel which takes feature map with index k as input and produces feature map with index τ as output, P k is the array of feature map with index k of the input, K is the number of feature maps of the input. 1 Note that the neural network is an optimized mapping from channel features to the RIS phase shifts. For different channels as inputs, the phase shifts are different. Therefore, the achieved data rate is not the ergodic rate. When applied in a straightforward manner, the cross-correlation operation makes the size of Q τ smaller than the size of P k . We use zero padding [37] such that the size of output equals the input size, which is illustrated in Fig. 3. Intuitively, the number of zeros added to each side of the input in the horizontal direction is where w f is the filter size in the horizontal direction. Note that w f has to be an odd number such that w z is an integer. A similar relationship can be obtained for the vertical direction. In this way, the sizes of input and output are kept identical. The size of the filters and the number of convolutional layers should be designed in such a way, that each output elementary unit has its receptive field 2 of the whole RIS. This idea is illustrated in Fig. 4. Since every filter aggregates information from both sides in the horizontal direction by (w f − 1)/2, the required number of layers is such that the receptive field of a unit on one edge covers a unit on the opposite edge. Equation (12) can be extended to the vertical layer easily. In order to prevent overfitting and to improve robustness, we put a dropout layer [38] between each convolutional layer, which randomly turns off a certain portion of neurons.
After all layers, the output of the FCN Ψ is the array of phase shifts of all RIS antennas of size H × W . The structure of the proposed FCN is shown in Fig. 5. The computation of the FCN is denoted as θ is the parameters of the FCN (i.e., all biases and filters of all layers), Γ is the input feature map, Ψ = (ψ n ) is the two-dimensional array with linearly addressed elements ψ n , n = 1, . . . , N , n is the index of the RIS antenna.

B. Definition of Features
In problem (3), we assume that the channel state information (CSI) at the RIS controller is known, which is a common assumption in relevant works [5], [39]- [42]. Although the channel estimation involving an RIS is challenging due to the large number of RIS antennas, there are multiple promising attempts to estimate the channel with sufficient accuracy in real-time, such as [43]- [46]. Besides, the CSI can also be used as intermediate information to derive an RIS optimization method with an input easier to obtain than the CSI itself, such as user locations [47].
Therefore, we believe that CSI based RIS optimization has practical importance in the near future.
Among the channel matrices, H is assumed to be constant because both BS and RIS are stationary, G and D vary with the user positions and are required to compute Φ and V. We would like to interpret G and D as two feature maps with element index n referring to a certain RIS antenna. Accordingly, we can use our FCN. While each column of G can be injectively mapped to each RIS antenna, D is irrelevant to the RIS. Therefore, we define J = DH + and (1) becomes Equation (13)  can be injectively mapped to the RIS antennas. Therefore, the features of an RIS element at position (w, h) can be defined as where g kτ is the element in row k and column τ of G, j kτ is defined similarly to matrix J. In this way, we use 4U features to characterize the wireless channels with U users with respect to each RIS antenna n, yielding the FCN input Γ = (G, J).

C. Objective Functions
Our objective function f in (3) is a function of channels G and D, RIS phase shifts Φ and BS precoding V.
When Φ is determined, V can be computed with either MMSE precoder or WMMSE precoder as described in Section III, which are denoted as V MMSE (G, D, Φ) and V WMMSE (G, D, Φ), respectively. It is to note that V MMSE is a differentiable function but V WMMSE is not differentiable.
Since f is a function of G, D, Φ and V, we can express f as f (G, D, Φ, V). Therefore, for MMSE precoding, the objective function is D) , For WMMSE precoding, the objective function is f G, D, exp jΨ θ (G, D) , Please note that Ψθ in (16) is untrainable, i.e.,θ is given and Ψθ(G, D) is a constant. Therefore, we do not need to compute the derivative of V WMMSE since it does not contain trainable variable θ.
We can then compute ∂f ∂θ to do gradient ascent to optimize Ψ θ such that f is maximized for both (15) and (16). The compositions of the objective functions is illustrated in Fig. 6. The Adam optimizer [48] is chosen to perform the optimization. With the WMMSE precoder, the structure of the objective function is similar, but V is no more a function of G, D and Φ, but a constant which is updated periodically. Therefore, we do not compute the derivative of V.
Since the gradient ascent improves the objective monotonically and the objective WSR is bounded from above with a finite transmit power, the iterative optimization must converge in the end of training. In practice, we use stochastic gradient ascent instead of gradient ascent. The gradient is computed for a randomly sampled batch of data rather than the whole data set. After that, another batch with newly sampled data is used for the next gradient ascent step. As a result, we cannot guarantee monotonicity in the optimization. However, the stochastic gradient ascent is a standard technique in machine learning and machine learning practice shows that if the data samples are identically distributed and the batch size is sufficiently large, the stochastic gradient ascent shows solid convergence behavior, which is also true in our case, as will be shown in Section VI.
Note that the proposed approach is an unsupervised learning method. In supervised learning, a target is provided for each input. The optimizer tries to minimize the difference between the output of the neural network and the target (or label). The loss function is usually defined as MSE (for continuous output) or cross entropy (for categorical output). By minimizing the loss function, the neural network learns to reproduce the given target. In our problem, the target is unknown and therefore not given. By maximizing the objective function (15) or (16), the neural network learns an optimized mapping from channel features Γ to the RIS phase shift Ψ that maximizes the WSR. We believe that the unsupervised approach has a wider range of application since the target is unavailable for many difficult problems. Besides, if the target is already available, it is difficult to justify why we use machine learning to reproduce the target that is already known (common reasons are, e.g., it is very time-consuming to obtain the target and the evaluation of the neural network is faster than the original algorithm [49], or the purpose of machine learning is the predistortion of a distorted signal and the target (the original signal) is therefore known [50]). Nevertheless, it is of great practical importance and also very exciting if the neural network finds a good solution by itself without supervision.

V. TRAINING PROCESS FORMULATION AND IMPLEMENTATION CONSIDERATIONS
A. The Two-Phase Training As described in Section III, the MMSE precoder is simple and differentiable and the WMMSE precoder has a higher performance at the cost of complexity and nondifferentiability. During the training, we apply the MMSE precoder and use (15) as the objective function in the first phase of training for a fast training and then switch to the WMMSE precoder and use (16) as the objective function to further improve the WSR in the second phase of training.
In the first phase, objective (15) is a function composition and its derivative can be computed with the chain rule. The MMSE precoding matrix is computed with the current phase shifts Ψ. On the contrary, in the second phase, the precoding matrix V WMMSE is nondifferentiable and is considered constant. Since V WMMSE changes with the channel, when Ψ changes because of the training, V WMMSE is no more valid. Therefore, we update V WMMSE every 10 epochs during training.
In the iterative WMMSE precoding algorithm (Algorithm 1), the initial precoding matrix is arbitrary subject to the transmit power constraint. The iteration is supposed to continue until convergence. In our training, however, it is desirable that (a) we only run a few iterations such that the training time is reasonable, (b) the updated precoding matrix is close to the precoding matrix from the previous update, such that a drastic change is avoided and the training process is more fluent. With these considerations, we use the previous precoding matrix as the initial precoding matrix in the next update and run 5 iterations per update. In the first WMMSE precoding matrix update, the MMSE precoding matrix is applied. Although the WMMSE precoding matrix is not updated in real time as the MMSE precoding matrix, the change of the WMMSE is smooth and the training process is stable, as will be shown in Section VI.
Besides the above-mentioned complexity consideration, another important reason for applying MMSE precoder in the first phase of the training is that the WMMSE precoder selects users by weighting them with different w u in Algorithm 1. If the channel condition is poor and transmit power is insufficient following the water-filling principle [51], the WMMSE precoder selects good users and allocate no power to poor users, which is the situation for many data samples in the beginning of training since the RIS is randomly initialized and cannot realize a good channel. During the RIS optimization, since the poor user does not have any transmit power, the RIS is optimized only for the good user and the poor user is ignored. Therefore, the WMMSE precoder does not allocate any transmit power to the poor user in the next iteration because the channel to the good user is improved by the RIS but the channel to the poor user is not improved. As a result, user selection under the initial poor channel quality may last until the end of training, which results in a suboptimal performance. On the contrary, the MMSE precoder treats the two users equally and the RIS tries to improve the channel quality for both users. In the end of the first phase, channel quality is significantly improved compared to the initialization. Therefore, user selection of the WMMSE precoder abandons less users, which results in a high WSR and better fairness. The two-phase training is a reasonable choice especially when the initial channel quality is poor.
The proposed training is formulated in Algorithm 2.

Algorithm 2 FCN Training in two phases repeat
Compute the gradient of the objective (15)

B. Solution for Discrete Phase Shifts
Although the above-described method optimizes the phase shifts of RIS antennas such that the WSR is improved significantly, a practical RIS is expected to have discrete phase shifts with a high granularity (e.g., π) rather than continuous phase shifts in order to reduce the hardware complexity and cost. The phase shift of each antenna is chosen from a finite set of discrete phases Φ d , rather than a continuous value. In this section, we propose a penalty term to convert continuous phase shifts to discrete phase shifts while keeping the performance loss as low as possible. The penalty term is defined as the smallest Frobenius norm between continuous phase shift and the closest feasible discrete phase defined by Φ d : The objective is defined as where κ is the factor for the penalty term. The training process with discrete phase shifts is formulated as Algorithm 3.

Algorithm 3 FCN Training with Discrete Phase Shifts repeat
Compute the gradient of the objective (15)  until p is smaller than a given threshold

C. Implementation
We employ PyTorch [52] as the machine learning framework, which only supports real-valued inputs and parameters. Therefore, the channel features (14) use amplitude and phase to describe a complex channel gain.
On the contrary, since PyTorch 1.9, complex numbers are supported in the objective function, which significantly reduces the complexity in implementation of (15) and (16). After implementation of the objective function, the gradient is computed with PyTorch's differentiation engine Autograd [52] without human intervention.

VI. TRAINING AND EVALUATION RESULTS
In this section, we present the training and evaluation results. We apply a ray tracing channel simulator in an urban environment [53], where mobile users are supposed to have high demand for data rates. We generate channel from the BS to the RIS H, channels from the RIS to the users G and the direct channels D of 5000 pairs of users, whose positions are randomly generated with a minimum distance of 2 meters between them. The scenario is shown in Fig. 7, where a line-of-sight (LoS) propagation path between BS and users is assumed to be unavailable due to the blockage by a building in the middle. A weak direct path is available through reflection on the building in the lower right corner. An RIS is equipped such that there are LoS propagation paths from BS to RIS and from RIS to users. A building behind the BS enables a strong reflection path from BS to RIS such that channel matrix H has a rank higher 3 than 1.
Note that we assume the channel from BS to RIS H is a constant, which holds because both positions of BS and RIS are fixed. However, it requires per-BS-RIS-pair channel measurement and training before deployment and when surrounding environment changes (e.g., a new building is built nearby), which should be plausible since per-cell optimization is a common practice [29], [54]- [56]. The LoS propagation path between BS and users is blocked by the high building in the middle. However, LoS propagation paths from BS to RIS and from RIS to users exist. A building behind the BS enables a strong reflection path from BS to RIS. A weak direct path is available through reflection on the building in the lower right corner.
The important parameters of scenario and model are presented in Table I. If multiple parameter values are considered, the default value is marked with a star (*), which is always used without explicit specification. Fig. 8 shows the improvement of the WSR with two users, a TSNR of 10 11 and user weights of (0.5, 0.5) in training (therefore, the sum rate is the WSR in the figure times 2). As explained in Section V, we first use the MMSE precoder to train the model for 4000 epochs, then switch to the WMMSE precoder for further training. It can be observed that the training has improved the WSR significantly with the MMSE precoder and the WMMSE precoder outperforms the MMSE precoder. Fig. 9 shows the first 100 epochs of the training with the WMMSE precoder (i.e., epochs 4000 -4100 in Fig. 8).
Time points, where the precoding vectors are updated with the WMMSE precoder are marked with the red dots. At the beginning of the training with the WMMSE precoder, there is always a considerable performance improvement after the precoding vectors are updated. The performance is then improved slightly due to the FCN improvement.
The improvement slows down as the training carries on until convergence. Fig. 10 shows the WSR improvement with four users and two-phase training. Since the weights of all four users are 0.25, the sum rate is the WSR in the figure times 4. Compare Fig. 8 and Fig. 10, we can observe that the scenario with four users achieves slightly better performance with longer training time. The reason for the better performance is the higher potential to reuse the spectrum resource due to the larger number of users whereas the reason for the longer training time is the more complicated objective function and neural architecture. However, the advantage of four users compared to two users is only marginal. As described in Section V-A, the WMMSE precoder allocates no transmit power to poor users when the available transmit power is insufficient following the water-filling principle. In order to verify whether the marginal advantage of four users is due to the transmit power The comparison of achieved sum rate in the testing set (i.e., data that are not seen by the optimizer such that we can test the generality of the trained model) with equal user weights and different algorithms is shown in Fig. 11, where we choose the block coordinate descent (BCD) algorithm in [5] as a baseline. It can be observed that all three setups achieve similar sum rates with the the TSNR of 10 11 but the two setups with four users significantly outperform the setup with two users with the TSNR of 10 13 and the proposed algorithm is better than the BCD algorithm. This result validates that the transmit power is the constraint that prevent the four-user scenario from outperforming the two-user scenario significantly.  Table I, 1024 4 Note that this is not realistic assumption given a typical noise power. The purpose of this assumption is only to validate whether the transmit power constraint prevents the four-user scenario from outperforming the two-user scenario significantly. data samples are tested in total. We can observe that two users have a data rate of 0 in more than half (577) of all data samples with the TSNR of 10 11 , which makes the four-user scenario equivalent to the two-user scenario.
Therefore, the average performance difference between the two scenarios is very small. On the contrary, no user has 0 data rate with the TSNR of 10 13 . This is because the resource is fully reused and the sum rate outperforms the two-user scenario as a result. To compare the proposed solution with other algorithms, we choose random RIS phase shifts and phase shifts optimized with the BCD algorithm proposed as Algorithm 2 in [5] as two baselines. The number of iterations is increased from 100 in the original paper to 5000 due to the larger number of RIS antennas. All three algorithms use the WMMSE precoder. As before, the FCN is evaluated with the testing data set. once before the application. Testing FCN with 1024 channel samples takes merely a few seconds while running the BCD algorithm takes more than 4 hours with a 12-core CPU (channel samples are processed in parallel with the parfor loop in MATLAB). This makes the proposed approach much more promising to be deployed in the near future for real-time applications given hardware with comparable performance as of today. Besides, Fig. 13 also shows the achieved sum rate with random channel estimate error, which is assumed to be an independent and identically distributed (i.i.d.) Gaussian random error. The ratio between standard deviation of the Gaussian random error and the mean channel gain is denoted as γ. We can observe that the FCN is robust against a channel estimate error partially because of the dropout layers, which add noise to inputs of each convolutional layer in the training and therefore enhance robustness of the neural work. This result shows that the proposed solution does not require very precise channel estimation in order to work, which would be very challenging in RIS-aided systems. Fig. 14 shows the sum rate with the same user weights (0.5, 0.5) and different TSNR. We can see that higher TSNR (i.e., transmit power) increases the data rate considerably and the RIS configured by the FCN outperforms random phase shifts and phase shifts optimized with the BCD algorithm for all tested TSNRs. It is also to note that the performance of the FCN is robust against random channel estimation errors.
In the evaluation, we have obtained a WSR of 6.87 bit/s/Hz for TSNR=10 11 . Compared to the WSR at the end of training (7.26 bit/s/Hz), the WSR in the evaluation is roughly 5% less than the WSR in the training, which suggests a low overfitting level and a good generalization of the trained model.    again. It is also to note that the ECDF of the proposed algorithm is flatter than the other two algorithms and the outage probability that the WSR is less than a given threshold is higher with the proposed algorithm than with the BCD algorithm proposed in [5], suggesting that the performance depends more heavily on the channels.
The proposed algorithm only brings significantly advantage with favorable channels. Therefore, user selection is crucially important for the best performance, which remains an open problem.
Finally, we evaluate the performance with discrete phase shifts with a granularity of π. Fig. 17 shows the penalty (defined in (17)) development during training with the WMMSE precoder. Algorithm 3 effectively reduces the difference between the output phase shift and the predefined discrete phase shifts. The WSR reduces as the FCN output is being discretized. After training, we force the output phase to be one of the predefined phases and compare the result between the model without discretization (i.e., with Algorithm 2) and the model with discretization (i.e., with Algorithm 3), which realize a sum rate of 5.72 bit/s/Hz and 6.05 bit/s/Hz, respectively. This result suggests that the proposed discretization method in Section V-B realizes only a marginal improvement compared to brutal discretization. To the authors' best knowledge, it remains an open problem to obtain the global optimum of a high dimensional combinatorial optimization problem.
Besides the simpler RIS hardware, another benefit of the discrete phase shift is the small amount of controlling signal. With the default assumption of number of RIS antennas and two discrete phase shifts, which can be represented by one bit, the RIS controlling signal has a data amount of 256 bit, which can be easily transmitted within the next-generation wireless communication systems.

VII. CONCLUSIONS
We proposed an FCN based solution for spatial multiplexing enabled by a RIS in this paper. The FCN is a widely applied neural network architecture for computer vision but has not yet been used for RIS configuration.
The rectangular shape of the RIS and the spatial correlation of channels on adjacent antennas of the RIS encourage us to apply the FCN to the RIS configuration. We use the simple and differentiable MMSE precoder for pretraining and the iterative and complex WMMSE precoder with periodically updated precoding vectors to fine-tune the model.
A set of channel features is designed to include both cascaded channels via the RIS and the direct channel. We use a ray-tracing simulator to generate channel models with spatial correlation. Evaluation results show that the proposed solution achieves higher performance and also shows faster evaluation speed than the baselines. Therefore, it can be better scaled to a large number of antennas. The dropout layers between the convolutional layers of the FCN reduce overfitting. A penalty term is introduced to discretize FCN output such that the proposed method can be applied to RISs with discrete phase shifts.
It is shown that the WSR depends strongly on the wireless channels. As future works, it is desirable to find a criterion to optimally decide which users are selected to share the same resource block, which can significantly improve the average performance. Furthermore, more advanced techniques of interference management, such as nonorthogonal multiple access (NOMA) and rate splitting, can also be combined with RIS and may achieve a better performance than treating interference as noise.
The source code and channel data of this paper will be provided for public access if the article is accepted.