I am looking for a nengo_DL function that would take a tensor_layer as input and return the height and width. I have tried tensor.get_shape().as_list() but this is not working in nengo_dl.
TensorNodes need to return a tf.Tensor
, whereas tensor.get_shape().as_list()
returns a list. What you want is tf.shape(tensor)
, which will return a tf.Tensor
containing the shape.
To be clear, I’m assuming that what you’re trying to do is write a TensorNode
(or tensor_layer
) that returns the shape of its input. If you just want to know what the shape of a tensor is, then tensor.get_shape()
will work as well.
Yes, this is perfect. Thank you!
I tried using the tensor.get_shape(), however it is causing an error that says "function object has no attribute get_shape. What would be causing this? Know any fixes?
That means that your tensor
object is not a tf.Tensor
. You can check the type of a Python variable using print(type(tensor))
.