# Mixed precision with TPU on google colab

**URL:** <https://discuss.ai.google.dev/t/mixed-precision-with-tpu-on-google-colab/29674>\
**Category:** General Discussion\
**Tags:** gpu, xla, model\_garden, help\_request\
**Created:** [October 22, 2021, 3:05am UTC](https://discuss.ai.google.dev/t/mixed-precision-with-tpu-on-google-colab/29674 "2021-10-22T03:05:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grishma\_Prasad](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/grishma_prasad/32/9300_2.png) [@Grishma\_Prasad](https://discuss.ai.google.dev/u/Grishma_Prasad)\
**Post date:** [October 22, 2021, 3:05am UTC](https://discuss.ai.google.dev/t/mixed-precision-with-tpu-on-google-colab/29674/1 "2021-10-22T03:05:14Z")

</div>

Hello,

On Colab, I don’t have the GPU with minimum required compute capability for mixed precision. So I decided to use TPU and set the policy as ‘mixed\_bfloat16’. However, while performing transfer learning using EfficientNetB0, I get the following error. I am not able to find solutions online as well. I am also not sure if this is because I am using TPU or if there is something I am missing. Any help would be great. This is the error:

## /usr/local/lib/python3.7/dist-packages/keras/utils/generic\_utils.py:497: CustomMaskWarning: Custom mask layers require a config and must override get\_config. When loading, the custom mask layer must be passed to the custom\_objects argument.

category=CustomMaskWarning)  
Epoch 1/2

InvalidArgumentError Traceback (most recent call last)  
in ()  
----\> 1 hist1 = model.fit(train\_data,steps\_per\_epoch=len(train\_data),epochs=2, validation\_data=test\_data,validation\_steps=int(0.15\*len(test\_data)),callbacks = [callback1,callback2])

6 frames  
/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick\_execute(op\_name, num\_outputs, inputs, attrs, ctx, name)  
58 ctx.ensure\_initialized()  
59 tensors = pywrap\_tfe.TFE\_Py\_Execute(ctx.\_handle, device\_name, op\_name,  
—\> 60 inputs, attrs, num\_outputs)  
61 except core.\_NotOkStatusException as e:  
62 if name is not None:

InvalidArgumentError: No OpKernel was registered to support Op ‘DepthwiseConv2dNativeBackpropInput’ used by {{node gradient\_tape/model\_7/efficientnetb0/block7a\_dwconv/depthwise/DepthwiseConv2dNativeBackpropInput}} with these attrs: [dilations=[1, 1, 1, 1], T=DT\_BFLOAT16, data\_format=“NHWC”, strides=[1, 1, 1, 1], explicit\_paddings=, padding=“SAME”]  
Registered devices: [CPU]  
Registered kernels:  
device=‘XLA\_CPU\_JIT’; T in [DT\_FLOAT, DT\_DOUBLE, DT\_BFLOAT16, DT\_HALF]  
device=‘XLA\_GPU\_JIT’; T in [DT\_FLOAT, DT\_DOUBLE, DT\_BFLOAT16, DT\_HALF]  
device=‘GPU’; T in [DT\_DOUBLE]  
device=‘GPU’; T in [DT\_FLOAT]  
device=‘GPU’; T in [DT\_HALF]  
device=‘CPU’; T in [DT\_DOUBLE]  
device=‘CPU’; T in [DT\_FLOAT]  
device=‘CPU’; T in [DT\_HALF]  
device=‘GPU’; label=‘cudnn\_grouped\_convolution’; T in [DT\_DOUBLE]  
device=‘GPU’; label=‘cudnn\_grouped\_convolution’; T in [DT\_FLOAT]  
device=‘GPU’; label=‘cudnn\_grouped\_convolution’; T in [DT\_HALF]

---

<div class="post-metadata">

**Author:** ![chunduriv](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@chunduriv](https://discuss.ai.google.dev/u/chunduriv)\
**Post date:** [September 5, 2022, 8:12am UTC](https://discuss.ai.google.dev/t/mixed-precision-with-tpu-on-google-colab/29674/2 "2022-09-05T08:12:03Z")

</div>

What is the version of Tensorflow you are using? and in order to expedite the trouble-shooting process, please provide a stand alone code to reproduce the issue reported here. Thank you.
