File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 112
112
113
113
# We move our tensor to the GPU if available
114
114
if torch .cuda .is_available ():
115
- tensor = tensor .to (' cuda' )
115
+ tensor = tensor .to (" cuda" )
116
116
117
117
118
118
######################################################################
124
124
# **Standard numpy-like indexing and slicing:**
125
125
126
126
tensor = torch .ones (4 , 4 )
127
- print (' First row: ' , tensor [0 ])
128
- print (' First column: ' , tensor [:, 0 ])
129
- print (' Last column:' , tensor [..., - 1 ])
127
+ print (f" First row: { tensor [0 ]} " )
128
+ print (f" First column: { tensor [:, 0 ]} " )
129
+ print (f" Last column: { tensor [..., - 1 ]} " )
130
130
tensor [:,1 ] = 0
131
131
print (tensor )
132
132
172
172
# Operations that store the result into the operand are called in-place. They are denoted by a ``_`` suffix.
173
173
# For example: ``x.copy_(y)``, ``x.t_()``, will change ``x``.
174
174
175
- print (tensor , " \n " )
175
+ print (f" { tensor } \n " )
176
176
tensor .add_ (5 )
177
177
print (tensor )
178
178
You can’t perform that action at this time.
0 commit comments