| 76 | } |
| 77 | |
| 78 | ValueRef make_empty_tensor( |
| 79 | CompNodeValue::ref_t device, ValueRef shape, DTypeValue::ref_t dtype) { |
| 80 | HostTensorStorage storage(*device); |
| 81 | storage.ensure_size(dtype->size()); |
| 82 | std::memset(storage.ptr(), 0, dtype->size()); |
| 83 | auto t = imperative::apply( |
| 84 | CreateTensor(CreateTensor::Const, *device, *dtype, ValueShape()), |
| 85 | HostStorage::make(storage))[0]; |
| 86 | auto res = broadcast_to(t, shape); |
| 87 | return res; |
| 88 | } |
| 89 | |
| 90 | std::optional<ValueRefList> matrix_mul_grad_rule( |
| 91 | const OpDef& op, Span<ValueRef> inputs, Span<bool> inputs_require_grad, |
no test coverage detected