KerasTensor和tf.tensor之间的转换
@lmx666-gif It happens for the older version of TF . Could you try to upgrade it using the following;
```
pip install tensorflow --upgrade
```
Otherwise you can also run the following and restart the kernel
import tensorflow as tf
tf.enable_eager_execution(). 

Please let us know if it helps?
Thank you! Hello, neither of two methods can turn a kerasTensor into a TF.tensor.  I found "tf.compat.v1.disable_eager_execution()" could let KerasTensor changed into TF.Tensor, however, this problem:**RuntimeError: `tf.data.Dataset` only supports Python-style iteration in eager mode or within tf.function.** @lmx666-gif Thank you for the response!
Could you please share the standalone code to replicate the issue here. 
Thank you! Thank you for your response!

The first is the map function:
    def map_function(example):

        feature_map = {"wav_raw": tf.io.FixedLenFeature([], tf.string)}
        parsed_example = tf.io.parse_single_example(example, features=feature_map)

        wav_slice = tf.io.decode_raw(parsed_example["wav_raw"], out_type=tf.float64)
        wav_slice = tf.cast(wav_slice, tf.float32) / 2 ** 15

        return wav_slice

The second one is the training process:

     for epoch in range(args.num_epochs):
              
        trainset = tf.data.TFRecordDataset(args.trainset_tfrecords_path)
        trainset = trainset.map(map_func=map_function,
                                num_parallel_calls=num_cpus)  # num_parallel_calls should be number of cpu cores

        #trainset = trainset.shuffle(buffer_size=args.batch_size * 200, reshuffle_each_iteration=True)
        trainset = trainset.batch(batch_size=args.batch_size)
        trainset = trainset.prefetch(buffer_size=args.batch_size)


        # train_loss for each epoch
        train_loss_epoch = []
        train_loss = 0.0

        # record the train time for each epoch
        start = time.time()
        # MASK参数

        #EMA_MODEL来选择mask的index

        binary_mask = RandomMaskingGenerator(input_size,frame_length,mask_ratio)
        # bmr:0为掩码，1为未掩码；
        # bm_T:1为掩码,0为未掩码；
        # bm,bm_T = binary_mask()
        

        for step, _input in enumerate(trainset):
            bm, bm_T, _ = binary_mask.random_mask(_input.shape[0],alpha_e_max)#.totally_random_mask(_input.shape[0])
            print("_input",_input)
            # print("bm_shape", bm.shape)
            # print("bm_T_shape", bm_T.shape)
            loss_value = train_step(_input,_input*bm,bm_T)
            loss_float = float(loss_value)

            train_loss_epoch.append(loss_float)

            # Calculate the accumulated train loss value
            train_loss += loss_float



        # average train loss for each epoch
        train_loss /= (step + 1)
        train_loss_all.append(train_loss)

        # print log
        log = "train epoch {}/{}, train_loss = {:.06f}, time = {:.06f}"
The third one is the train_step function:

    @tf.function
    def train_step(_input,_input_mask,bm_T):
        with tf.GradientTape() as tape:
            enc_output, batch_mean, batch_var = sem_enc(_input_mask)
            #输入进去semantic decoder
            print("main:",enc_output)
            _output = sem_dec([enc_output, batch_mean, batch_var])
            loss_value = mse_loss(tf.multiply(_input, bm_T), _output)
            tf.print(loss_value)
            loss_whole = loss_value

        grads = tape.gradient(loss_whole, weights_all)  # compute gradients
        optimizer.apply_gradients(zip(grads, weights_all))  # update parameters

        return loss_whole



The _ouput generated by sem_dec() is the value I wanted change it from kerasTensor to TF.tensor; I could send you the whole codes, if you need, this is my email: limingxiao@link.cuhk.edu.cn. Thank you for your reply! Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61307">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61307">No</a>
 In addition, before the new question, I found that the tensor in my model is kerasTensor; however, the tensor returned to my main function is chaned into tf.tensor; Rediculously! @lmx666-gif Could you share the complete code and other dependencies to replicate this issue. I have faced different issues [here](https://colab.research.google.com/gist/sushreebarsa/372264e42bbe4b6f0731f9a29f08ebf2/untitled1250.ipynb). Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61307">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61307">No</a>

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

tf2.4

### Custom code

Yes

### OS platform and distribution

Window10

### Mobile device

_No response_

### Python version

3.8

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

KerasTensor没有numpy（）这种，应该如何转换

### Standalone code to reproduce the issue

```shell
File "C:/Users/KM Group/Desktop/lmx/SemanticCompression-Speech/DeepSC-S-main/random_mask_training.py", line 73, in <module>
    sem_dec = sem_dec_model(frame_length, stride_length, args)
  File "C:\Users\KM Group\Desktop\lmx\SemanticCompression-Speech\DeepSC-S-main\model_tfnn.py", line 191, in sem_dec_model
    _output = sem_dec(_intput, batch_mean, batch_var)
  File "C:\Users\KM Group\Desktop\lmx\SemanticCompression-Speech\DeepSC-S-main\model_tfnn.py", line 142, in __call__
    _input = tf.convert_to_tensor(keras.backend.get_value(_input))
  File "C:\Users\KM Group\Anaconda3\envs\speech-SC\lib\site-packages\tensorflow\python\keras\backend.py", line 3615, in get_value
    return x.numpy()
AttributeError: 'KerasTensor' object has no attribute 'numpy'
```


### Relevant log output

_No response_