rstudio / tensorflow

TensorFlow for R
https://tensorflow.rstudio.com
Apache License 2.0
1.33k stars 318 forks source link

set_shape([None]) in R Tensorflow #557

Closed langzeng closed 1 year ago

langzeng commented 1 year ago

Hi, I'm trying to implement a tf function (which works in Python Tensorflow) in R.Tensorflow. Could you please show me how to translate the python code "loc.set_shape([None])" in R?

"loc" is a location mask that will be passed to tf.boolean_mask(tensor, mask=loc). I'm using loc.set_shape([None]) because the shape of loc is dynamic and I follow the advice from https://stackoverflow.com/questions/48978984/tensorflow-boolean-mask-with-dynamic-mask/48986289#48986289

Thank you in advance!

t-kalinowski commented 1 year ago

what happens if you call loc$set_shape(list(NULL))?

langzeng commented 1 year ago

It works! Thank you very much.