Merged changes from origin. This should fix dot products between tensors, allow assignment through reorderings, add "nan_to_num" numpy equivalent, and make float/int casting work like numpy