Archive d’étiquettes pour : Change


“In this PyTorch tutorial, we will see how to change the view of a tensor in PyTorch. PyTorch is an open-source framework available with a Python programming language.

A tensor is a multidimensional array that is used to store the data. So for using a Tensor, we have to import the torch module.

To create a tensor, the method used is tensor()”

Syntax:

Where data is a multi-dimensional array.

tensor.view()

view() in PyTorch is used to change the tensor object view by converting it into a specified number of rows and columns.

Syntax:

It takes two parameters.

  1. r specifies the number of rows to be formed from the tensor_object.
  2. c specifies the number of columns to be formed from the tensor_object.

Be sure that the coetáneo tensor object contains an even count of elements.

Example 1

Here, we will create a tensor that holds six elements with Float type and change its view that has 3 rows and 2 columns.

#import torch module

import torch

 

 

#create 1D tensor with Float data type that hold 6 elements

data1 = torch.FloatTensor([23,45,54,32,23,78])

#display

print(«Coetáneo Tensor: «,data1)

 

#change the data1 view to 3 rows and 2 columns.

print(«Tensor with 3 rows and 2 columns: «,data1.view(3,2))

Output:

Coetáneo Tensor: tensor([23., 45., 54., 32., 23., 78.])

Tensor with 3 rows et 2 columns: tensor([[23., 45.],

[54., 32.],

[23., 78.]])

We can see that the view of the tensor is changed to 3 rows and 2 columns.

Example 2

Here, we will create a tensor that holds six elements with Float type and change its view that has 2 rows and 3 columns.

#import torch module

import torch

 

 

#create 1D tensor with Float data type that hold 6 elements

data1 = torch.FloatTensor([23,45,54,32,23,78])

#display

print(«Coetáneo Tensor: «,data1)

 

#change the data1 view to 2 rows and 3 columns.

print(«Tensor with 2 rows and 3 columns: «,data1.view(2,3))

Output:

Coetáneo Tensor: tensor([23., 45., 54., 32., 23., 78.])

Tensor with 2 rows et 3 columns: tensor([[23., 45., 54.],

[32., 23., 78.]])

We can see that the view of the tensor is changed to 2 rows and 3 columns.

Change the datatype

It can be possible to change the datatype of the tensor using view().

We need to specify the datatype inside the view method.

Syntax:

tensor_object.view(torch.datatype)

Parameter:

It takes datatype as a parameter like int8,int16, etc.

Example 1

In this example, we will create a tensor with Float type and convert it to int data types.

dtype is used to return the datatype of a tensor.

#import torch module

import torch

 

 

#create 1D tensor with Float data type that hold 6 elements

data1 = torch.FloatTensor([23,45,54,32,23,78])

#display

print(«Coetáneo Tensor data type: «,data1.dtype)

 

#change the data1 data type to int8

print(«Converting to int8: «,data1.view(torch.int8).dtype)

#change the data1 data type to int16

print(«Converting to int16: «,data1.view(torch.int16).dtype)

#change the data1 data type to int32

print(«Converting to int32: «,data1.view(torch.int32).dtype)

#change the data1 data type to int64

print(«Converting to int64: «,data1.view(torch.int64).dtype)

Output:

Coetáneo Tensor data type: torch.float32

Converting to int8: torch.int8

Converting to int16: torch.int16

Converting to int32: torch.int32

Converting to int64: torch.int64

Example 2

In this example, we will create a tensor with Float type and convert it to int data types and get the size.

#import torch module

import torch

 

 

#create 1D tensor with Float data type that hold 6 elements

data1 = torch.FloatTensor([23,45,54,32,23,78])

#display

print(«Coetáneo Tensor datatype: «,data1.size())

#change the data1 datatype to int8

print(«Converting to int8: «,data1.view(torch.int8).size())

#change the data1 datatype to int16

print(«Converting to int16: «,data1.view(torch.int16).size())

#change the data1 datatype to int32

print(«Converting to int32: «,data1.view(torch.int32).size())

#change the data1 datatype to int64

print(«Converting to int64: «,data1.view(torch.int64).size())

Output:

Coetáneo Tensor datatype: torch.Size([6])

Converting to int8: torch.Size([24])

Converting to int16: torch.Size([12])

Converting to int32: torch.Size([6])

Converting to int64: torch.Size([3])

Conclusion

In this PyTorch lesson, we discussed how to change the view of a tensor in pytorch using view() and also modify the datatypes of an existing tensor by specifying data types inside the view() method.



Source link


When you buy a new Chromebook, you definitely change the look of your desktop. Changing the desktop wallpaper is one of the tasks that everyone wants to do because it gives your laptop a whole new look. Now if you have any queries in your mind about how to change the Chromebook’s wallpaper, check out this article.

How to change the wallpaper on Chromebook

The three ways to select and change a wallpaper on Chromebook:

  1. Applying pre-installed wallpaper
  2. Applying a custom wallpaper
  3. Applying the same wallpaper on multiple Chromebooks

1: Applying a pre-installed wallpaper

This is the easiest and fastest method to use a pre-downloaded wallpaper on your Chromebook. You can find these wallpapers through these steps:

Step 1: Right-click on the desktop and select the Set wallpaper option:

Step 2: Select an image of your choice to set as wallpaper. You can also set your wallpaper to change daily by enabling the Daily Refresh option:

2: Applying a custom wallpaper

If the picture you are going to use as wallpaper is downloaded to your system, then it can be easily used as wallpaper. When the picture is downloaded, follow this method to change the Chromebook’s wallpaper.

Step 1: Click the launcher option on the left corner of the screen and click My Files:

Step 2: Select the folder with your image:

Step 3: Right-click on the image and select set wallpaper:

Note: Keep in mind that the low-quality images won’t look great, so always download the high-quality wallpapers.

3: Applying same wallpaper on multiple Chromebooks

You can sync wallpaper across multiple Chromebook by following the steps given below:

Step 1: Click on the display time at the left corner of the screen:

Step 2: Select Settings:

Step 3: Click on Sync and Google services in Accounts:

Step 4: Click on Manage what you sync:

Step 5: To use the same wallpaper on every device you have to turn on Sync everything:

Conclusion

Changing the wallpaper on your Chromebook is very easy as it enables you to change the look of your desktop. There are always some default wallpapers present in the Chromebook, you can apply them to get a new look. You can also get the same look on multiple Chromebooks by applying the same wallpaper on other Chromebooks. If you ever face any issue in changing the wallpaper on your Chromebook, don’t worry and simply abide by the above-mentioned steps to change the wallpaper.



Source link


“Almost everything productive we can do in Linux requires us to have a network connection. Whether developing apps, installing software, scripting, sharing files, or even watching movies, we need a working network connection. Hence, “I require a network connection” is simply an understatement. The only way to enable network connection on a machine is through a network interface.

A network interface is a device or a point of connection between a device and a private or public network. In most cases, a network interface is a physical card such as a wireless adapter, a network card, etc. However, this does not necessarily mean that a network interface should be a physical device. For example, a loopback adapter that is not physically visible is implemented by software and available on all devices.”

This quick tutorial will show you how to set the default interface in Linux.

Method 1 – Turn Off Adapters

The simplest way to set your default network interface is by disabling all other interfaces. For example, in Linux, you can use the GUI network manager or the terminal.

Suppose you have a wireless adapter and you wish to use the Ethernet adapter; in that case, you can bring down the wifi adapter using the command:

$ sudo ifconfig wlan0 down
$ sudo ifconfig eth0 up

The above commands will shut down the wireless adapter and bring up the ethernet adapter.

That will force the system to switch to the available network.

NOTE: The above command requires sudo or root privileges with the net-tools package installed.

Start by using the command:

The command above should list the default gateways available in the system, including the default interface.

An example output is as shown:

default via 192.168.0.1 dev wlan0 proto dhcp metric 100
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.10 metric 100

As we can see from the output above, the default interface is set to wlan0. However, we can change this by following a few steps.

Start by removing all the default interfaces with the command:

$ sudo ip route flush 0/0

The command should remove all the default gateways. You can verify by running the ip list command:

An example output:

169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.10 metric 100

We can now proceed to add a default interface using the ip route command.

$ sudo ip route add default via 192.168.0.2 dev eth0

NOTE: Ensure to replace the IP address of the interface with your desired one.

Merienda executed successfully, the command should add the interface eth0 is the default.

We can verify this by running the ip route command:

$ sudo ip route list
default via 192.168.0.2 dev eth0
169.254.0.0/16 dev eth0 scope link metric 1000
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.10 metric 100

The output shows that the default interface is set to eth0 with our specified IP address.

Conclusion

That’s it for this one. In this article, we discussed how to change your default interface in Linux in two primary methods.

Thanks for reading!!



Source link


Roblox is a widely used gaming platform where you can find tons of games of different genres. If you are new to this platform and want to change your display name with username then follow this guide as I have explained the process of changing the username as well as the display name of your Roblox account.

Changing the Display Name of your Roblox account

Every player on the Roblox wants to keep a name that somehow represents them well and makes their altibajo look cooler. The display name is not a unique name and it mostly used to represent you while playing games as it is displayed on your head. So, to change the display name log in to your Roblox account and then go the settings by clicking on the settings icon as shown in the image below:

Merienda you have opened the settings you will see your basic account information like display name, username, Email and many other things as in the image below:

Now to edit the display name click on the edit icon in the front of display name as in the image below:

A pop-up of display name edit will open as shown in the image below :

Now you can change the current name to the new name and press the “Save” button.

Also read the important note that is written above the save button which says that you cannot change the name twice in a week. So, if you need to change the name that you saved a few days ago then you have to wait for 7 days to change it again.

Changing the Username of your Roblox account

The username is a unique name that is mainly used to find other players on the platform because there might be the possibility that there are alot players with the same display name. Now let’s move on to how to change your username on your Roblox account, so for that you need to go to the Settings of your account and open the Account Info. Next you have to click on the edit icon in front of the username and a pop-up for username will appear.

If you have 1000 Robux in your account then it will ask for the new username and otherwise you will see a pop-up as in the image below:

If you are interested in buying 1000 Robux then click on the Buy button and you will see the deals as shown in the image below:

From here you can select how much Robux you want to buy and then it will ask you the payment methods. Select one as shown in the image below and click on the Continue button:

Next follow the steps and buy the Robux and then change your username.

Conclusion

Roblox is an online gaming platform that gives its users a worthwhile experience of gaming and also provides a chance to its primum users to develop games of their own. So, in other words Roblox provides a potential platform for the gamers to put their ideas to work.

If you are new to this platform and want to change your display name and username then this guide will be helpful as we have explained the process of changing the display name and the username in a detailed way.



Source link


The colors in life, either in nature or in front of the computer screen, have a great effect on the human mind as they can change the mood from dull to energetic and also from energetic to dull. If you are an Ubuntu user, then you can observe the default color of the folder icons present in different directories is blackish or sometimes purple color, as shown in the image below:

In this write-up, we will discover the method by which we can change the color of the folder colors in the new release of Ubuntu 22.04.

How to change the folder color in Ubuntu 22.04

To change the color of the folders in Ubuntu, we have to add the PPA repository of the package of Yaru-color-theme to the default repository list of the Ubuntu:

$ sudo add-apt-repository ppa:costales/yaru-colors-folder-color

When the PPA repository has been added to the Ubuntu’s default repository list, we will use update the system:

Now with the help of the apt package manager, we will install the yaru-colors-folder-color package whose repository has been added in the previous commands:

$ sudo apt install yaru-colors-folder-color folder-color  -y

Now we will quit the file manager “nautilus” by using the flag “q”:

When the package is installed successfully, we can navigate to any directory and right-click on any folder, for example, we will right-click on the “object” folder, and context menu will appear, choose the “Folder’s Color” option:

Another list will be open containing different colors, choose the color you want to set on the folder, for example, we have chosen the green color:

The color of the “object” folder has changed to green color:

Similarly, you can change the color of any folder to any other color.

Conclusion

If you are bored with the default look of Ubuntu, then you can change the color of the folders. In this guide, we have provided the method of changing the colors of folders of Ubuntu by simply installing the folder-color package, after installing it folder colors can be changed to any color.



Source link