hookeai.simulators.fetorch.material.models.vmap.drucker_prager.convert_dict_to_float32

convert_dict_to_float32(tensor_dict, is_inplace=True)[source]

Convert all floating point torch tensors in dictionary to torch.float32.

Torch tensors with type torch.float32 or other non-float types are kept unchanged.

Nested dictionaries are processed recursively.

Parameters:
  • tensor_dict (dict) – Dictionary.

  • is_inplace (bool, default=True) – If True, then input dictionary is updated in-place.

Returns:

tensor_dict – Dictionary.

Return type:

dict