-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add LBFGS optimizer #22
Conversation
delete tanh_grad
add tanh_grag
python/oneflow/nn/optimizer/lbfgs.py
Outdated
# | ||
# new_opt_confs = [] | ||
# for param_group in self.param_groups: | ||
# optimizer_conf = train_conf.optimizer_conf.add() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无效代码可以去掉
python/oneflow/nn/optimizer/lbfgs.py
Outdated
views = [] | ||
for p in self.parameters: | ||
if p.grad is None: | ||
view = flow.tensor(np.zeros(p.numel())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处使用了numpy,可否用oneflow.zeros算子代替
python/oneflow/nn/optimizer/lbfgs.py
Outdated
from typing import Callable, Dict, Iterator, List, Tuple, Union | ||
from functools import reduce | ||
from collections import defaultdict, abc as container_abcs | ||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议框架代码中import numpy
python/oneflow/nn/optimizer/lbfgs.py
Outdated
import oneflow as flow | ||
from oneflow.nn.optimizer.optimizer import Optimizer, ParamGroup | ||
from oneflow.nn.parameter import Parameter | ||
import functools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
与上边from functools import reduce是否有重复
python/oneflow/nn/optimizer/lbfgs.py
Outdated
limitations under the License. | ||
""" | ||
import collections | ||
import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
math是否有导入的必要
python/oneflow/nn/optimizer/lbfgs.py
Outdated
import math | ||
from typing import Callable, Dict, Iterator, List, Tuple, Union | ||
from functools import reduce | ||
from collections import defaultdict, abc as container_abcs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
与上边import collections重复
python/oneflow/nn/optimizer/lbfgs.py
Outdated
""" | ||
import collections | ||
import math | ||
from typing import Callable, Dict, Iterator, List, Tuple, Union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tuple貌似没有用到
No description provided.