pytorch/caffe2/sgd/math_lp.h
Jongsoo Park 086dba3804 [caffe2] move fused SparseAdagrad to open source (#35164)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35164

As title

Test Plan: CI

Reviewed By: jianyuh

Differential Revision: D20581853

fbshipit-source-id: 393ddd9487cd965c465eaa49e1509863618a6048
2020-03-26 17:29:12 -07:00

34 lines
655 B
C++

#pragma once
#ifdef __AVX__
#include <immintrin.h>
#endif
#include "caffe2/utils/math.h"
namespace caffe2 {
namespace internal {
// Z=X*Y
template <typename XT, typename YT, typename ZT>
void dot(const int N, const XT* x, const YT* y, ZT* z, CPUContext* ctx) {
CAFFE_THROW("Unsupported, see specialized implementations");
}
template <>
void dot<float, float, float>(
const int N,
const float* x,
const float* y,
float* z,
CPUContext* ctx);
template <>
void dot<float, at::Half, float>(
const int N,
const float* x,
const at::Half* y,
float* z,
CPUContext* ctx);
} // namespace internal
} // namespace caffe2