LostTech.TensorFlow : API Documentation

Type ITensor

Namespace tensorflow

Interfaces I_TensorLike, IEnumerable

Public instance methods

object eval(object feed_dict, object session)

object experimental_ref()

Returns a hashable reference object to this Tensor.

Warning: Experimental API that could be changed or removed.

The primary usecase for this API is to put tensors in a set/dictionary. We can't put tensors in a set/dictionary as `tensor.__hash__()` is no longer available starting Tensorflow 2.0. Instead, we can use `tensor.experimental_ref()`. Also, the reference object provides `.deref()` function that returns the original Tensor.
Show Example
import tensorflow as tf 

x = tf.constant(5) y = tf.constant(10) z = tf.constant(10)

# The followings will raise an exception starting 2.0 # TypeError: Tensor is unhashable if Tensor equality is enabled. tensor_set = {x, y, z} tensor_dict = {x: 'five', y: 'ten', z: 'ten'}

object set_shape_(object shape)

Public properties

object device get;

object dtype get;

object graph get;

object name get;

object op get;

object shape get;

object value_index get;