mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Infer schema for experimental ops (#20513)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/20513 They've been using an old API, switch them to the new one instead. Reviewed By: li-roy Differential Revision: D15346349 fbshipit-source-id: 538eb460897ec6addebeebf88b316eb0d6b1dd6f
This commit is contained in:
committed by
Facebook Github Bot
parent
9bd3305592
commit
09f22d10a6
@ -71,16 +71,7 @@ void add_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Add",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("input1"),
|
||||
c10::Argument("input2"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("legacy_broadcast", BoolType::get()),
|
||||
c10::Argument("axis", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Add",
|
||||
c10::kernel<decltype(add_op_cpu_impl<float>), &add_op_cpu_impl<float>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -44,12 +44,7 @@ class averaged_loss_cpu final : public c10::OperatorKernel {
|
||||
};
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::AveragedLoss",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::AveragedLoss",
|
||||
c10::kernel<averaged_loss_cpu<float, CPUContext>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -65,13 +65,7 @@ void batch_gather_op_cpu(const at::Tensor& data,
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::BatchGather",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("data"),
|
||||
c10::Argument("indices"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::BatchGather",
|
||||
c10::kernel<decltype(batch_gather_op_cpu), &batch_gather_op_cpu>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -269,17 +269,7 @@ class batch_matmul_cpu final : public c10::OperatorKernel {
|
||||
};
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::BatchMatmul",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("A"),
|
||||
c10::Argument("B"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("trans_a", IntType::get()),
|
||||
c10::Argument("trans_b", IntType::get()),
|
||||
c10::Argument("broadcast", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::BatchMatmul",
|
||||
c10::kernel<batch_matmul_cpu<float, CPUContext>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -87,15 +87,7 @@ void cast_op_cpu(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Cast",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("input"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("to_dtype", IntType::get()),
|
||||
}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Cast",
|
||||
c10::kernel<decltype(cast_op_cpu), &cast_op_cpu>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -105,16 +105,7 @@ void concat_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Concat",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("split_info"),
|
||||
c10::Argument("add", IntType::get()),
|
||||
c10::Argument("add_axis", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Concat",
|
||||
c10::kernel<
|
||||
decltype(concat_op_cpu_impl<float, CPUContext>),
|
||||
&concat_op_cpu_impl<float, CPUContext>>(),
|
||||
|
@ -25,11 +25,7 @@ void enforce_finite_op_impl_cpu(const at::Tensor& input_) {
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::EnforceFinite",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::EnforceFinite",
|
||||
c10::kernel<
|
||||
decltype(enforce_finite_op_impl_cpu<float>),
|
||||
&enforce_finite_op_impl_cpu<float>>(),
|
||||
|
@ -55,13 +55,7 @@ class expand_dims_cpu final : public c10::OperatorKernel {
|
||||
};
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::ExpandDims",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("dims", ListType::ofInts())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::ExpandDims",
|
||||
c10::kernel<expand_dims_cpu<float>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -129,16 +129,7 @@ class fc_op_cpu final : public c10::OperatorKernel {
|
||||
};
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::FullyConnected",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("X"),
|
||||
c10::Argument("W"),
|
||||
c10::Argument("b"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("axis", IntType::get()),
|
||||
c10::Argument("axis_w", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::FullyConnected",
|
||||
c10::kernel<fc_op_cpu<float, CPUContext>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -145,82 +145,27 @@ void uniform_fill_op_cpu_impl(
|
||||
|
||||
static auto registry =
|
||||
c10::RegisterOperators()
|
||||
.op(FunctionSchema(
|
||||
"_c10_experimental::ConstantFill",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("shape", ListType::ofInts()),
|
||||
c10::Argument("extra_shape", ListType::ofInts()),
|
||||
c10::Argument("input_as_shape", BoolType::get()),
|
||||
c10::Argument("dtype", IntType::get()),
|
||||
c10::Argument("value", NumberType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
.op("_c10_experimental::ConstantFill",
|
||||
c10::kernel<
|
||||
decltype(constant_fill_op_cpu_impl),
|
||||
&constant_fill_op_cpu_impl>(),
|
||||
c10::dispatchKey(CPUTensorId()))
|
||||
.op(FunctionSchema(
|
||||
"_c10_experimental::UniformFill",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("shape", ListType::ofInts()),
|
||||
c10::Argument("extra_shape", ListType::ofInts()),
|
||||
c10::Argument("input_as_shape", BoolType::get()),
|
||||
c10::Argument("min", FloatType::get()),
|
||||
c10::Argument("max", FloatType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
.op("_c10_experimental::UniformFill",
|
||||
c10::kernel<
|
||||
decltype(uniform_fill_op_cpu_impl),
|
||||
&uniform_fill_op_cpu_impl>(),
|
||||
c10::dispatchKey(CPUTensorId()))
|
||||
.op(FunctionSchema(
|
||||
"_c10_experimental::GivenTensorFill",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("shape", ListType::ofInts()),
|
||||
c10::Argument("extra_shape", ListType::ofInts()),
|
||||
c10::Argument("input_as_shape", BoolType::get()),
|
||||
c10::Argument("values"),
|
||||
}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
.op("_c10_experimental::GivenTensorFill",
|
||||
c10::kernel<
|
||||
decltype(given_tensor_fill_op_cpu_impl<float, CPUContext>),
|
||||
&given_tensor_fill_op_cpu_impl<float, CPUContext>>(),
|
||||
c10::dispatchKey(CPUTensorId()))
|
||||
.op(FunctionSchema(
|
||||
"_c10_experimental::GivenTensorIntFill",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("shape", ListType::ofInts()),
|
||||
c10::Argument("extra_shape", ListType::ofInts()),
|
||||
c10::Argument("input_as_shape", BoolType::get()),
|
||||
c10::Argument("values"),
|
||||
}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
.op("_c10_experimental::GivenTensorIntFill",
|
||||
c10::kernel<
|
||||
decltype(given_tensor_fill_op_cpu_impl<int, CPUContext>),
|
||||
&given_tensor_fill_op_cpu_impl<int, CPUContext>>(),
|
||||
c10::dispatchKey(CPUTensorId()))
|
||||
.op(FunctionSchema(
|
||||
"_c10_experimental::GivenTensorInt64Fill",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("inputs", ListType::ofTensors()),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("shape", ListType::ofInts()),
|
||||
c10::Argument("extra_shape", ListType::ofInts()),
|
||||
c10::Argument("input_as_shape", BoolType::get()),
|
||||
c10::Argument("values"),
|
||||
}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
.op("_c10_experimental::GivenTensorInt64Fill",
|
||||
c10::kernel<
|
||||
decltype(given_tensor_fill_op_cpu_impl<int, CPUContext>),
|
||||
&given_tensor_fill_op_cpu_impl<int, CPUContext>>(),
|
||||
|
@ -27,13 +27,7 @@ void flatten_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Flatten",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("axis", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Flatten",
|
||||
c10::kernel<
|
||||
decltype(flatten_op_cpu_impl<float, CPUContext>),
|
||||
&flatten_op_cpu_impl<float, CPUContext>>(),
|
||||
|
@ -72,16 +72,7 @@ void mul_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Mul",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("input1"),
|
||||
c10::Argument("input2"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("legacy_broadcast", BoolType::get()),
|
||||
c10::Argument("axis", IntType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Mul",
|
||||
c10::kernel<decltype(mul_op_cpu_impl<float>), &mul_op_cpu_impl<float>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -41,12 +41,7 @@ void relu_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Relu",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Relu",
|
||||
c10::kernel<decltype(relu_op_cpu_impl<float>), &relu_op_cpu_impl<float>>(),
|
||||
c10::dispatchKey(CPUTensorId()));
|
||||
|
||||
|
@ -24,12 +24,7 @@ void sigmoid_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::Sigmoid",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::Sigmoid",
|
||||
c10::kernel<
|
||||
decltype(sigmoid_op_cpu_impl<float>),
|
||||
&sigmoid_op_cpu_impl<float>>(),
|
||||
|
@ -71,16 +71,7 @@ void sigmoid_cross_entropy_with_logits_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::SigmoidCrossEntropyWithLogits",
|
||||
"",
|
||||
(std::vector<c10::Argument>{
|
||||
c10::Argument("input1"),
|
||||
c10::Argument("input2"),
|
||||
c10::Argument("output"),
|
||||
c10::Argument("log_D_trick", BoolType::get()),
|
||||
c10::Argument("unjoined_lr_loss", BoolType::get())}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::SigmoidCrossEntropyWithLogits",
|
||||
c10::kernel<
|
||||
decltype(sigmoid_cross_entropy_with_logits_op_cpu_impl),
|
||||
&sigmoid_cross_entropy_with_logits_op_cpu_impl>(),
|
||||
|
@ -82,14 +82,7 @@ void sparse_lengths_sum_op_cpu(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::SparseLengthsSum",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("data"),
|
||||
c10::Argument("indices"),
|
||||
c10::Argument("lengths"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::SparseLengthsSum",
|
||||
c10::kernel<
|
||||
decltype(sparse_lengths_sum_op_cpu),
|
||||
&sparse_lengths_sum_op_cpu>(),
|
||||
|
@ -20,12 +20,7 @@ void stop_gradient_op_cpu_impl(
|
||||
}
|
||||
|
||||
static auto registry = c10::RegisterOperators().op(
|
||||
FunctionSchema(
|
||||
"_c10_experimental::StopGradient",
|
||||
"",
|
||||
(std::vector<c10::Argument>{c10::Argument("input"),
|
||||
c10::Argument("output")}),
|
||||
(std::vector<c10::Argument>{})),
|
||||
"_c10_experimental::StopGradient",
|
||||
c10::kernel<
|
||||
decltype(stop_gradient_op_cpu_impl<float>),
|
||||
&stop_gradient_op_cpu_impl<float>>(),
|
||||
|
Reference in New Issue
Block a user