#include "tensorflow/core/framework/op.h"#include "tensorflow/core/framework/shape_inference.h"#include "tensorflow/cc/framework/gradients.h"#include "tensorflow/cc/ops/standard_ops.h"
using namespace tensorflow;
REGISTER_OP("CustomSymbolicGradients").Input("outputs: float").Input("inputs: float").Output("grad_outputs: float").SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) { //c->set_output(0, c->input(0)); // change output shape using Attr return Status::OK();});
#include "tensorflow/core/framework/op_kernel.h"
class CustomSymbolicGradientsOp : public OpKernel {
public:
void Compute(OpKernelContext* context) override { Scope l_scope = Scope::NewRootScope();
// Grab the input tensor const Tensor &outputs_tensor = context->input(0); const Tensor &inputs_tensor = context->input(1); std::vector<Output> l_vecGrads;
Output l_outputs = tensorflow::ops::DeepCopy(l_scope, outputs_tensor); Output l_inputs = tensorflow::ops::DeepCopy(l_scope, inputs_tensor); tensorflow::AddSymbolicGradients(l_scope, { l_outputs }, { l_inputs }, &l_vecGrads); Input l_output = l_vecGrads[0]; Tensor l_tensor = l_output.tensor(); // Create an output tensor Tensor* output_tensor = NULL; OP_REQUIRES_OK(context, context->allocate_output(0, l_tensor.shape(), &output_tensor)); output_tensor = &l_tensor;
}
};
REGISTER_KERNEL_BUILDER(Name("CustomSymbolicGradients").Device(DEVICE_CPU), CustomSymbolicGradientsOp);C:/testops/test35/tensorflow-r1.14/tensorflow/core/BUILD:1263:1: C++
compilation of rule '//tensorflow/core:user_ops_op_lib' failed (Exit
2): cl.exe failed: error executing command
cd
C:/users/admin/_bazel_admin/erbfhnu2/execroot/org_tensorflow
SET
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows
Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\shared;C:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\um;C:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\winrt;
SET
PATH=C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program
Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files
(x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Program Files
(x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows
Kits\10\bin\x86;C:\Program Files (x86)\Microsoft
SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\;;C:\WINDOWS\system32
SET
PWD=/proc/self/cwd
SET
PYTHON_BIN_PATH=C:/Program Files (x86)/Microsoft Visual
Studio/Shared/Python36_64/python.exe
SET
PYTHON_LIB_PATH=C:/Program Files (x86)/Microsoft Visual
Studio/Shared/Python36_64/lib/site-packages
SET
TEMP=C:\Users\Admin\AppData\Local\Temp
SET
TF_CONFIGURE_IOS=0
SET
TF_DOWNLOAD_CLANG=0
SET
TF_NEED_CUDA=0
SET
TF_NEED_OPENCL_SYCL=0
SET
TF_NEED_ROCM=0
SET
TMP=C:\Users\Admin\AppData\Local\Temp
C:/Program Files
(x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe /nologo
/DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500
/EHsc /wd4351 /wd4291 /wd4250 /wd4996 /I.
/Ibazel-out/x64_windows-opt/genfiles /Ibazel-out/x64_windows-opt/bin
/Iexternal/com_google_absl
/Ibazel-out/x64_windows-opt/genfiles/external/com_google_absl
/Ibazel-out/x64_windows-opt/bin/external/com_google_absl
/Iexternal/eigen_archive
/Ibazel-out/x64_windows-opt/genfiles/external/eigen_archive
/Ibazel-out/x64_windows-opt/bin/external/eigen_archive
/Iexternal/local_config_sycl
/Ibazel-out/x64_windows-opt/genfiles/external/local_config_sycl
/Ibazel-out/x64_windows-opt/bin/external/local_config_sycl
/Iexternal/nsync /Ibazel-out/x64_windows-opt/genfiles/external/nsync
/Ibazel-out/x64_windows-opt/bin/external/nsync /Iexternal/gif_archive
/Ibazel-out/x64_windows-opt/genfiles/external/gif_archive
/Ibazel-out/x64_windows-opt/bin/external/gif_archive /Iexternal/jpeg
/Ibazel-out/x64_windows-opt/genfiles/external/jpeg
/Ibazel-out/x64_windows-opt/bin/external/jpeg
/Iexternal/protobuf_archive
/Ibazel-out/x64_windows-opt/genfiles/external/protobuf_archive
/Ibazel-out/x64_windows-opt/bin/external/protobuf_archive
/Iexternal/com_googlesource_code_re2
/Ibazel-out/x64_windows-opt/genfiles/external/com_googlesource_code_re2
/Ibazel-out/x64_windows-opt/bin/external/com_googlesource_code_re2
/Iexternal/farmhash_archive
/Ibazel-out/x64_windows-opt/genfiles/external/farmhash_archive
/Ibazel-out/x64_windows-opt/bin/external/farmhash_archive
/Iexternal/fft2d /Ibazel-out/x64_windows-opt/genfiles/external/fft2d
/Ibazel-out/x64_windows-opt/bin/external/fft2d /Iexternal/highwayhash
/Ibazel-out/x64_windows-opt/genfiles/external/highwayhash
/Ibazel-out/x64_windows-opt/bin/external/highwayhash
/Iexternal/zlib_archive
/Ibazel-out/x64_windows-opt/genfiles/external/zlib_archive
/Ibazel-out/x64_windows-opt/bin/external/zlib_archive
/Iexternal/double_conversion
/Ibazel-out/x64_windows-opt/genfiles/external/double_conversion
/Ibazel-out/x64_windows-opt/bin/external/double_conversion
/Iexternal/snappy
/Ibazel-out/x64_windows-opt/genfiles/external/snappy
/Ibazel-out/x64_windows-opt/bin/external/snappy
/Iexternal/eigen_archive
/Ibazel-out/x64_windows-opt/genfiles/external/eigen_archive
/Ibazel-out/x64_windows-opt/bin/external/eigen_archive
/Iexternal/nsync/public
/Ibazel-out/x64_windows-opt/genfiles/external/nsync/public
/Ibazel-out/x64_windows-opt/bin/external/nsync/public
/Iexternal/gif_archive/lib
/Ibazel-out/x64_windows-opt/genfiles/external/gif_archive/lib
/Ibazel-out/x64_windows-opt/bin/external/gif_archive/lib
/Iexternal/gif_archive/windows
/Ibazel-out/x64_windows-opt/genfiles/external/gif_archive/windows
/Ibazel-out/x64_windows-opt/bin/external/gif_archive/windows
/Iexternal/protobuf_archive/src
/Ibazel-out/x64_windows-opt/genfiles/external/protobuf_archive/src
/Ibazel-out/x64_windows-opt/bin/external/protobuf_archive/src
/Iexternal/farmhash_archive/src
/Ibazel-out/x64_windows-opt/genfiles/external/farmhash_archive/src
/Ibazel-out/x64_windows-opt/bin/external/farmhash_archive/src
/Iexternal/zlib_archive
/Ibazel-out/x64_windows-opt/genfiles/external/zlib_archive
/Ibazel-out/x64_windows-opt/bin/external/zlib_archive
/Iexternal/double_conversion
/Ibazel-out/x64_windows-opt/genfiles/external/double_conversion
/Ibazel-out/x64_windows-opt/bin/external/double_conversion
/D__CLANG_SUPPORT_DYN_ANNOTATION__ /DEIGEN_MPL2_ONLY
/DEIGEN_MAX_ALIGN_BYTES=64 /DEIGEN_HAS_TYPE_TRAITS=0 /DTF_USE_SNAPPY
/showIncludes /MD /O2 /Oy- /DNDEBUG /wd4117 -D__DATE__="redacted"
-D__TIMESTAMP__="redacted" -D__TIME__="redacted"
/Gy /Gw -w -DWIN32_LEAN_AND_MEAN -DNOGDI
-DTENSORFLOW_MONOLITHIC_BUILD /DPLATFORM_WINDOWS /DEIGEN_HAS_C99_MATH
/DTENSORFLOW_USE_EIGEN_THREADPOOL /DEIGEN_AVOID_STL_ARRAY
/Iexternal/gemmlowp /wd4018 /wd4577 /DNOGDI /DTF_COMPILE_LIBRARY
/Fobazel-out/x64_windows-opt/bin/tensorflow/core/_objs/user_ops_op_lib/custom_symbolic_gradients.obj
/c tensorflow/core/user_ops/custom_symbolic_gradients.cc
Execution platform:
@bazel_tools//platforms:host_platform
.\tensorflow/cc/ops/standard_ops.h(19):
fatal error C1083: Cannot open include file:
'tensorflow/cc/ops/array_ops.h': No such file or directory