oneflow
oneflow copied to clipboard
OneFlow is a deep learning framework designed to be user-friendly, scalable and efficient.
- 问题来源: https://github.com/Oneflow-Inc/oneflow/issues/8831
背景:https://github.com/Oneflow-Inc/OneTeam/issues/1600 此PR完成了: - 增加了 `clamp_min` , `clamp_max` , `clamp_min_` , `clamp_max_` 接口并增加了相应的文档和单元测试 实现方式:全部都在 functor 层调用 `ClampBaseFunctor` 实现 文档截图: 此外,发现 clamp 系列存在两个问题,需要之后修复: - 不支持 out 参数 - min / max 不支持...
修复所有 Tensor 初始化方法对 non-contiguous Tensor 访问内存错误的问题,并添加相关测试
背景:https://github.com/Oneflow-Inc/OneTeam/issues/1519 概述:缺少 `column_stack` api 实现:本PR实现了以下接口及其单测、文档 - column_stack - row_stack - vstack - hstack - dstack - atleast_1d - atleast_2d - atleast_3d 文档: (atleast_1d example最下面的 >>> 已经改掉了)    ...
clip_grad默认不检查isnan和isinf。这样对齐了pytorch
Dev wkv
目前有个将 [RWKV-v4](https://github.com/BlinkDL/RWKV-LM/tree/main/RWKV-v4) 迁移到 libai 的需求。由于 [RWKV-v4](https://github.com/BlinkDL/RWKV-LM/tree/main/RWKV-v4) 自定义了 cuda 算子 [wkv](https://github.com/BlinkDL/RWKV-CUDA),因此需要将 [wkv](https://github.com/BlinkDL/RWKV-CUDA) 迁移成 OneFlow 算子。该 pr 迁移了 [v2 版本的 wkv](https://github.com/BlinkDL/RWKV-CUDA/blob/main/wkv/cuda/wkv_cuda_v2.cu)。 - [wkv](https://github.com/BlinkDL/RWKV-CUDA).forward 用于推导 y 的值 -> flow._C.wkv - [wkv](https://github.com/BlinkDL/RWKV-CUDA).backward 用于计算参数的梯度 ->...
This PR aims to make nn graph use the unified autograd engine like eager mode. Background and discussion:https://github.com/Oneflow-Inc/OneTeam/issues/1504 The following optimizations have been adapted: - [x] Gradient Accumulation - [x]...
背景:https://github.com/Oneflow-Inc/OneCloud/issues/136#issuecomment-1194951405 问题概述:cosine_similarity 中,当两个输入的 dims 不同时,会报错。 PR的实现: 在cosine_similarity的实现中,当两个输入的shape不同时,会遍历两个shape,来生成一个max_shape,然后将两个输入都expand成该max_shape再进行后续计算。这里遍历的时候,下标写错了,导致访问越界。 torch的实现: cosine_similarity的处理: https://github.com/pytorch/pytorch/blob/62c8d30f9f6715d0b60d78fb5f5913a2f3bd185b/aten/src/ATen/native/Distance.cpp#L275-L280 生成max_shape的处理: https://github.com/pytorch/pytorch/blob/62c8d30f9f6715d0b60d78fb5f5913a2f3bd185b/aten/src/ATen/ExpandUtils.cpp#L17-L43
- 添加 broadcast_matmul_grad_b 二阶导算子 - 矩阵乘法 a * b - 对 b 的梯度计算由 broadcast_matmul_grad_b 计算,需要另外实现二阶导算子, - 对 a 的梯度计算由 matmul 计算,已闭包,不需要另外实现二阶导算子(broadcast 时还需要 reduce_sum_like 的一阶导 https://github.com/Oneflow-Inc/oneflow/issues/8831 )