Skip to content

Commit

Permalink
set_value adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Garrett authored and hellkite500 committed Sep 13, 2024
1 parent 0ef0c07 commit 44a16c1
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lstm/bmi_lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,30 +804,30 @@ def set_value(self, var_name: str, values:np.ndarray):
#self.get_value_ptr(var_name)[:] = values
internal_array[:] = values

#short_name = self._var_name_map_long_first[ var_name ]
short_name = self._var_name_map_long_first[ var_name ]

# Better approach, assuming type is "ndarray" (SDP)
# setattr( self, short_name, values )

# if (value.ndim > 0):
# setattr( self, short_name, value[0])
# else:
# setattr( self, short_name, value )
if (internal_array.ndim > 0):
setattr( self, short_name, internal_array[0])
else:
setattr( self, short_name, internal_array )

# try:
# #NJF From NGEN, `value` is a singleton array
# setattr( self, var_name, value[0] )
#
# # jmframe: this next line is basically a duplicate.
# # I guess we should stick with the attribute names instead of a dictionary approach.
# self._values[var_name] = value[0]
# # JLG 03242022: this isn't really an "error" block as standalone considers value as scalar?
# except TypeError:
# setattr( self, var_name, value )
#
# # jmframe: this next line is basically a duplicate.
# # I guess we should stick with the attribute names instead of a dictionary approach.
# self._values[var_name] = value
try:
#NJF From NGEN, `internal_array` is a singleton array
setattr( self, var_name, internal_array[0] )

# jmframe: this next line is basically a duplicate.
# I guess we should stick with the attribute names instead of a dictionary approach.
self._values[var_name] = internal_array[0]
# JLG 03242022: this isn't really an "error" block as standalone considers value as scalar?
except TypeError:
setattr( self, var_name, internal_array )

# jmframe: this next line is basically a duplicate.
# I guess we should stick with the attribute names instead of a dictionary approach.
self._values[var_name] = internal_array

#------------------------------------------------------------
def set_value_at_indices(self, var_name: str, inds: np.ndarray, src: np.ndarray):
Expand Down

0 comments on commit 44a16c1

Please sign in to comment.