You can download this code by clicking the button below.
This code is now available for download.
This function generates a random matrix of a given number of rows and columns using the PyTorch library.
Technology Stack : PyTorch
Code Type : Function
Code Difficulty : Intermediate
import torch
import random
def generate_random_matrix(rows, cols):
"""
Generates a random matrix of given size using torch.
"""
return torch.randn(rows, cols)