Paddle
Paddle copied to clipboard
how to get the weights of layers
scope = fluid.global_scope();
scope.find_var('fc_0.w_0').get_tensor().set([1,2,3,4],fluid.CPUPlace())
1、I know the tensor has a set api can specified weights. But it seems the tensor doesn't have a get api ?
2、It seems set can change the tensor's shape?? I can set an arbitrary ndarray with any shape, that the tensor changed to the given shape??
- There is no interface to get the tensor date directly and currently the way to get weights' data is to run the executor to fetch the tensor out.
setindeed change the tensor's shape. When running the executor, the actual data and shape will be used.