Monday, 11 November 2019

Create Constant Tensors for Feeding in TensorFlow 2

In order to feed to tf.Session.run(feed_dict={...}), just array or numpy array should adequate, but a tensor is needed to call model @tf.function. The following code shows how to create constant tensors; there are 2 methods to do so.

Example code:
%tensorflow_version 2.x
%reset -f

#libs
import tensorflow as tf;
from tensorflow.keras.layers import *;

#code
T1 = tf.constant         ([1,2,3], tf.float32);
T2 = tf.convert_to_tensor([1,2,3], tf.float32);
print(T1);
print(T2);
#eof

1 comment:

  1. Casino in Miami - TrickToAction
    We are 토토 그래프 사이트 넷마블 open 24 hours a day, 꽁머니홍보 seven days a week, seven days a week, seven days a week. Casino in Miami is located 벳 인포 스포츠 토토 분석 벳피스트 in the Marina 꽁 머니 닷컴 District in 스포츠토토 최고배당 벳피스트

    ReplyDelete