Created by: zhouwei25
PR types
New features
PR changes
APIs
Describe
New API:
Layer.__dir__
modify dir() to make it easy for users to view the attr/parameters/sublayers/function of the Layer.
For example:
import paddle.fluid as fluid
import numpy as np
fluid.dygraph.enable_dygraph()
class Mylayer(fluid.dygraph.Layer):
def __init__(self):
super(Mylayer, self).__init__()
self.linear1 = fluid.dygraph.Linear(10, 10)
self.linear2 = fluid.dygraph.Linear(5, 5)
self.conv2d = fluid.dygraph.Conv2D(3, 2, 3)
self.embedding = fluid.dygraph.Embedding(size=[128, 16])
self.h_0 = fluid.dygraph.to_variable(np.zeros([10, 10]).astype('float32'))
mylayer = Mylayer()
print(dir(mylayer))