# Nones returned in tape.gradient in Conv-TasNet Implementation

**URL:** <https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184>\
**Category:** General Discussion\
**Tags:** models, help\_request\
**Created:** [February 15, 2022, 3:03am UTC](https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184 "2022-02-15T03:03:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beepbopboop](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/beepbopboop/32/9095_2.png) [@beepbopboop](https://discuss.ai.google.dev/u/beepbopboop)\
**Post date:** [February 15, 2022, 3:03am UTC](https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184/1 "2022-02-15T03:03:03Z")

</div>

Hi all;

I am attempting to implement Conv-TasNet for a course project. My train\_step code is at:

[https://github.com/AiEngineering/tf2-ConvTasNet/blob/87ce38922aa1e80aa7b0714cb52ace3a75a5a9eb/research/algorithm.py#L340](https://github.com/AiEngineering/tf2-ConvTasNet/blob/87ce38922aa1e80aa7b0714cb52ace3a75a5a9eb/research/algorithm.py#L340)

I’ve read the docs concerning [possible causes of having all Nones](https://www.tensorflow.org/guide/autodiff#getting_a_gradient_of_none) returned by tape.gradient; I’ve made sure to remove any NumPy code from my custom loss function, and am not quite sure what else may be causing the issue.

I don’t think the error is caused by the loss function; I ran a debugging session with a built-in loss function, and the same result (all Nones) occurs.

The trainable\_variables are tracked by tape, meaning the loss should be applied to a list of Variables as intended; so this should work, at least according to my knowledge of TensorFlow and Keras – which only spans about 6 weeks at the time of this posting.

I used the [MelGAN example](https://keras.io/examples/audio/melgan_spectrogram_inversion/) as a guide for how to implement a similar model; a main difference I can see in their code and mine is, I am not using (what appears to be) functional API concepts in my ConvBlock. Could that be the issue?

Regarding system/env:

Mac M1 Max  
Python 3.9.7  
TensorFlow/Keras 2.7

Conda environment is managed with miniforge.

---

<div class="post-metadata">

**Author:** ![Renu\_Patel](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/renu_patel/32/8957_2.png) [@Renu\_Patel](https://discuss.ai.google.dev/u/Renu_Patel)\
**Post date:** [October 4, 2023, 9:43am UTC](https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184/3 "2023-10-04T09:43:22Z")

</div>

Hi @beepbopboop

Welcome to the TensorFlow Forum!

The code link mentioned in this issue is not accessible. Please provide minimal reproducible code to replicate the error and fix it. Thank you

---

<div class="post-metadata">

**Author:** ![beepbopboop](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/beepbopboop/32/9095_2.png) [@beepbopboop](https://discuss.ai.google.dev/u/beepbopboop)\
**Post date:** [October 4, 2023, 1:07pm UTC](https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184/4 "2023-10-04T13:07:02Z")

</div>

Hi Renu! Apologies. This was so long ago and I have deleted the repo.

Tanget –– how do I update my username?

---

<div class="post-metadata">

**Author:** ![Renu\_Patel](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/renu_patel/32/8957_2.png) [@Renu\_Patel](https://discuss.ai.google.dev/u/Renu_Patel)\
**Post date:** [October 4, 2023, 1:15pm UTC](https://discuss.ai.google.dev/t/nones-returned-in-tape-gradient-in-conv-tasnet-implementation/31184/5 "2023-10-04T13:15:39Z")

</div>

You can check in your account summary - preferences - edit option.
