| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
621 バイト追加 、 2021年5月25日 (火) 14:31
</pre>
===テンソル===
----
====テンソルの作成====
<pre>
import tensorflow as tf
 
# 2x1行列
m1 = tf.constant([[1. , 2.]])
# 1x2行列
m2 = tf.constant([
[1],
[2]
])
# ランク3のテンソルを定義
m3 = tf.constant([
[
[1,2],
[3,4],
[5,6]
],
[
[7,8],
[9,10],
[11,12]
]
])
 
print(m1)
print(m2)
print(m3)
</pre>
*結果
<pre>
tf.Tensor([[1. 2.]], shape=(1, 2), dtype=float32)
tf.Tensor(
[[1]
[2]], shape=(2, 1), dtype=int32)
tf.Tensor(
[[[ 1 2]
[ 3 4]
[ 5 6]]
 
[[ 7 8]
[ 9 10]
[11 12]]], shape=(2, 3, 2), dtype=int32)
</pre>
===Tips===
====[https://analytics-note.xyz/programming/tensorflow-omp-error-libiomp5/ The kernel appears to have died. It will restart automatically.]====

案内メニュー