始める無料で始める

テンソルの確認と加算

気温データを収集していると、測定値が2度ずれていることに気づきました。adjustment テンソルとの互換性を確認するために、torch を使って temperatures テンソルの形状とデータ型を確認し、その後で temperatures に2度を加えてください。

torch ライブラリと temperatures テンソルは読み込まれています。

この演習はコースの一部です

PyTorchで学ぶIntroduction to Deep Learning

コースを見る

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

adjustment = torch.tensor([[2, 2, 2], [2, 2, 2]])

# Display the shape of the adjustment tensor
print("Adjustment shape:", adjustment.____)

# Display the type of the adjustment tensor
print("Adjustment type:", adjustment.____)

print("Temperatures shape:", temperatures.shape)
print("Temperatures type:", temperatures.dtype)
コードを編集して実行