| 211 | } |
| 212 | |
| 213 | ValueRefList get_var_shape_rule( |
| 214 | const GetVarShape& get_var_shape, Span<ValueRef> inputs, Span<bool> inputs_mask, |
| 215 | const Type<ScalarValue>& scalar_type) { |
| 216 | bool all_scalar = true; |
| 217 | mgb_assert(inputs.size() >= 1); |
| 218 | for (auto&& input_mask : inputs_mask) { |
| 219 | if (!input_mask) { |
| 220 | all_scalar = false; |
| 221 | } |
| 222 | } |
| 223 | if (all_scalar) { |
| 224 | auto device = inputs[0].device(); |
| 225 | auto storage = HostStorage::make(*device); |
| 226 | // storage->ensure_size(1); |
| 227 | return imperative::apply( |
| 228 | CreateTensor( |
| 229 | CreateTensor::Const, *device, dtype::Int32(), ValueShape{0}), |
| 230 | storage); |
| 231 | } else { |
| 232 | return imperative::apply(get_var_shape, inputs); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | ValueRefList reshape_rule( |
| 237 | const Reshape& reshape, Span<ValueRef> inputs, Span<bool> inputs_mask, |
nothing calls this directly
no test coverage detected