| 12 | static std::unordered_map<Typeinfo*, ScalarRule> scalar_rules; |
| 13 | |
| 14 | ValueRef make_scalar_shape(CompNode device) { |
| 15 | HostTensorND scalar_shape(device, {1}, dtype::Int32()); |
| 16 | scalar_shape.ptr<dt_int32>()[0] = 1; |
| 17 | return imperative::apply( |
| 18 | CreateTensor(CreateTensor::Const, device, scalar_shape.layout()), |
| 19 | HostStorage::make(scalar_shape.storage()))[0]; |
| 20 | } |
| 21 | |
| 22 | bool is_scalar_shape(ValueRef shape) { |
| 23 | // may have performance issue |
no test coverage detected