commit
de0f0948d9
|
@ -1602,13 +1602,6 @@ std::vector<ActionItem> MindIRPipeline() {
|
|||
}
|
||||
|
||||
#ifdef WITH_BACKEND
|
||||
std::vector<ActionItem> ServerPipeline(const ResourcePtr &resource) {
|
||||
auto actions = CommonPipeline();
|
||||
(void)actions.emplace_back(std::make_pair("optimize", VmOptimizeAction));
|
||||
(void)actions.emplace_back(std::make_pair("validate", ValidateAction));
|
||||
return actions;
|
||||
}
|
||||
|
||||
std::vector<ActionItem> PSchedulerPipeline(const ResourcePtr &resource) {
|
||||
if (resource->EnableCompileCache() && resource->func_graph() != nullptr) {
|
||||
return {std::make_pair("scheduler", StartPSSchedulerAction)};
|
||||
|
|
|
@ -43,7 +43,6 @@ bool DistributedSplitAction(const ResourcePtr &resource);
|
|||
std::vector<ActionItem> GePipeline();
|
||||
std::vector<ActionItem> VmPipeline(const ResourcePtr &resource);
|
||||
std::vector<ActionItem> MindIRPipeline();
|
||||
std::vector<ActionItem> ServerPipeline(const ResourcePtr &resource);
|
||||
std::vector<ActionItem> PSchedulerPipeline(const ResourcePtr &resource);
|
||||
abstract::AnalysisResult AbstractAnalyze(const ResourcePtr &resource, const FuncGraphPtr &func_graph,
|
||||
const abstract::AbstractBasePtrList &args_abs, bool clear = false);
|
||||
|
|
|
@ -87,12 +87,12 @@ void DeformableOffsetsPadFunction(std::vector<int64_t> *output_hw, const std::ve
|
|||
constexpr size_t right_index = 3;
|
||||
if (x_h != abstract::Shape::SHP_ANY) {
|
||||
out_h = static_cast<int64_t>(std::floor(1 + ((x_h * 1.0) + pads[top_index] + pads[bottom_index] - kernel_size[0] -
|
||||
static_cast<float>((kernel_size[0] - 1) * (dilations[h_axis] - 1))) /
|
||||
LongToFloat((kernel_size[0] - 1) * (dilations[h_axis] - 1))) /
|
||||
strides[h_axis]));
|
||||
}
|
||||
if (x_w != abstract::Shape::SHP_ANY) {
|
||||
out_w = static_cast<int64_t>(std::floor(1 + ((x_w * 1.0) + pads[left_index] + pads[right_index] - kernel_size[1] -
|
||||
static_cast<float>((kernel_size[1] - 1) * (dilations[w_axis] - 1))) /
|
||||
LongToFloat((kernel_size[1] - 1) * (dilations[w_axis] - 1))) /
|
||||
strides[w_axis]));
|
||||
}
|
||||
output_hw->push_back(out_h);
|
||||
|
|
|
@ -39,6 +39,26 @@ np_types = (np.int8, np.int16, np.int32, np.int64,
|
|||
np.float32, np.float64, np.bool_, np.complex64, np.complex128)
|
||||
|
||||
|
||||
def _check_input_data_type(input_data):
|
||||
"""Check the type of input_data for Tensor"""
|
||||
validator.check_value_type('input_data', input_data,
|
||||
(Tensor_, np.ndarray, np.str_, list, tuple, float, int, bool, complex),
|
||||
'Tensor')
|
||||
valid_dtypes = (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64,
|
||||
np.float16, np.float32, np.float64, np.bool_, np.str_, np.complex64, np.complex128)
|
||||
if isinstance(input_data, np.ndarray) and input_data.dtype not in valid_dtypes and \
|
||||
input_data.dtype.kind != 'U' and input_data.dtype.kind != 'S': # Support dtype np.str_
|
||||
raise TypeError(f"For Tensor, the input_data is a numpy array, "
|
||||
f"but it's data type: {input_data.dtype} is not in supported list: "
|
||||
f"{list(i.__name__ for i in valid_dtypes)}.")
|
||||
if isinstance(input_data, np.ndarray) and input_data.dtype.kind == "S" and \
|
||||
input_data.shape and context.get_context("enable_ge"):
|
||||
raise TypeError("For binary string input in GE mode, the shape of the data must be ()")
|
||||
if isinstance(input_data, (tuple, list)) and np.array(input_data).dtype not in valid_dtypes:
|
||||
raise TypeError(
|
||||
f"For Tensor, the input_data is {input_data} that contain unsupported element.")
|
||||
|
||||
|
||||
class Tensor(Tensor_):
|
||||
"""
|
||||
Tensor is a data structure that stores an n-dimensional array.
|
||||
|
@ -138,23 +158,7 @@ class Tensor(Tensor_):
|
|||
shape = _check_tensor_dynamic_shape(dtype, shape, init)
|
||||
Tensor_.__init__(self, dtype, shape)
|
||||
else:
|
||||
validator.check_value_type('input_data', input_data,
|
||||
(Tensor_, np.ndarray, np.str_, list, tuple, float, int, bool, complex),
|
||||
'Tensor')
|
||||
valid_dtypes = (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64,
|
||||
np.float16, np.float32, np.float64, np.bool_, np.str_, np.complex64, np.complex128)
|
||||
if isinstance(input_data, np.ndarray) and input_data.dtype not in valid_dtypes and \
|
||||
input_data.dtype.kind != 'U' and input_data.dtype.kind != 'S': # Support dtype np.str_
|
||||
raise TypeError(f"For Tensor, the input_data is a numpy array, "
|
||||
f"but it's data type: {input_data.dtype} is not in supported list: "
|
||||
f"{list(i.__name__ for i in valid_dtypes)}.")
|
||||
if isinstance(input_data, np.ndarray) and input_data.dtype.kind == "S" and \
|
||||
input_data.shape and context.get_context("enable_ge"):
|
||||
raise TypeError("For binary string input in GE mode, the shape of the data must be ()")
|
||||
if isinstance(input_data, (tuple, list)) and np.array(input_data).dtype not in valid_dtypes:
|
||||
raise TypeError(
|
||||
f"For Tensor, the input_data is {input_data} that contain unsupported element.")
|
||||
|
||||
_check_input_data_type(input_data)
|
||||
if dtype is not None:
|
||||
validator.check_type_name(
|
||||
'dtype', dtype, mstype.number_type + (mstype.bool_, mstype.string), "Tensor")
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include "pipeline/jit/action.h"
|
||||
namespace mindspore {
|
||||
namespace pipeline {
|
||||
std::vector<ActionItem> PServerPipeline(const ResourcePtr &resource) { return {}; }
|
||||
std::vector<ActionItem> PSchedulerPipeline(const ResourcePtr &resource) { return {}; }
|
||||
std::vector<ActionItem> ServerPipeline(const ResourcePtr &resource) { return {}; }
|
||||
} // namespace pipeline
|
||||
} // namespace mindspore
|
||||
|
|
Loading…
Reference in New Issue