File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -458,17 +458,25 @@ def get_bounds(self) -> TypeBounds:
458458 bounds_x , bounds_y , bounds_z = array .T .tolist () # type: ignore[misc]
459459 return bounds_x , bounds_y , bounds_z # type: ignore[return-value]
460460
461- @staticmethod
462461 def _parse_single_path (
462+ self ,
463463 path : TypePath ,
464464 * ,
465465 verify : bool = True ,
466466 ) -> Path :
467+ if isinstance (path , (torch .Tensor , np .ndarray )):
468+ class_name = self .__class__ .__name__
469+ message = (
470+ 'Expected type str or Path but found a tensor/array. Instead of'
471+ f' { class_name } (your_tensor),'
472+ f' use { class_name } (tensor=your_tensor).'
473+ )
474+ raise TypeError (message )
467475 try :
468476 path = Path (path ).expanduser ()
469477 except TypeError as err :
470478 message = (
471- f'Expected type str or Path but found { path } with type'
479+ f'Expected type str or Path but found an object with type'
472480 f' { type (path )} instead'
473481 )
474482 raise TypeError (message ) from err
You can’t perform that action at this time.
0 commit comments